Question: Hi I want to set filter on field `date` where the value of date field should within 24 hours.

`<filter name="date" string="Scheduled Date" domain="[('date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date', '&lt;=', datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>`

I tried this one, but this retrieves only the data where the date field contains today's date

Thanks in advance

Answer: 
You don't necessarily need to use a `Class` for that. You could just have the function defined in one file and then import it into the file that you are working in. It will be easiest if the two files are in the same folder.

File containing function, e.g. called **func.py**:

```
# File called 'func.py' saved in a folder
def add(a, b):
    result = a + b
    print(result)

```

File you are working in, e.g. called **working\_file.py**:

```
# File where the function should be used, placed in the same folder
import func         # This imports all functions contained inside 'func.py'

func.add(2, 3)      # Use the 'add'-function imported from 'func.py'

```

Running **working\_file.py** will return

```
5

```

If you would like to type `add(2, 3)` instead of `func.add(2, 3)`, you have to change the import statement in **func.py** to `from func import add`, which only imports that specific funciton.

Hope this cleared it up.
> 
> is there a way to turn this into a class saved on a separate file and
>  call for it on each of my other files?
> 
> 
> 

For example:

```
# bar.py
class TopUserCounter(object):

    def __init__(self, top_users):
        self._top_users = top_users

    def count(self, user_names):
        for name in user_names:
            if name not in self._top_users:
                self._top_users[name] = 1
            else:
                self._top_users[name] += 1

    def get_top_users(self):
        return dict(self._top_users)

# foo.py
from collections import Counter

from bar import TopUserCounter

top_user_counter = TopUserCounter({'Alex': 4, 'John': 3})
top_user_counter.count({'Alex', 'Damon'})
print(top_user_counter.get_top_users())

top_user_counter_1 = Counter({'Alex': 4, 'John': 3})
top_user_counter_1.update({'Alex', 'Damon'})
print(top_user_counter_1)

```