Hi I am storing user-defined functions in a separte file my_functions.py. For instance.
def some_func():
sleep(1)
print(1)
And the main code in another file main.py:
from time import sleep
from my_functions import *
some_func()
When I start main.py, I have an error that sleepdoes not detect. It seems that the things imported from my_functions.pydo not know aboutfrom time import sleep
Should I import a time module in my_funcions.py?
I feel embarrassed because I thought that it was imported only some_func, and if I write from time import sleepin my_functions.py, this sentence will not be fulfilled ...
And more general advice on how to store user-defined functions is appreciated. Thanks
source
share