How do I import and run a Python function and have all the dependencies it uses use the imports from the main Python file?
Main Python file:
from im import er
import time
er()
Python file with function to be imported:
def er():
time.sleep(1)
print('hi')
This doesn't work because the time
module is not imported in the im.py
. How can I make this work without importing the modules it needs each time I run the function?