How do I run a function from a different directory?
When I Import a function from a file in another folder and run it nothing happens. Does anyone know how to fix this without putting them in the same folder?
the reason you got the error is because for is because you did:
from folder.file1 import testdef print(file1.text1) #wrong
text1 is a local variable inside of
testdef, and you imported
file1, you need to do:
from folder.file1 import testdef print(testdef.text1)