My directory is as such:
isds:
__init__.py
jobs:
__init__.py
adhoc:
__init__.py
test.py
test2.py
My two files look like this.
test.py:
import sys
x = 10
test2.py:
import sys
from isds.jobs.adhoc.test import *
print(x)
When I run "python3 test2.py" from the same directory as test2.py, I get this error: ModuleNotFoundError: No module named 'isds.jobs.adhoc.test'
Why is this happening? I have the init.py files and I think I have the absolute import statement correct... but maybe not?
Thanks!
isdsdirectory as a place to look for modules or packages. You should use relative imports to get code from within the same package.from test import *as it's in the same directory-mflag as part of the accepted answer, I have posted the specific use case as an answer here, if you have any further questions or clarifications feel free to comment on my answer.