3 ms·
it was always meant as an helper: #a/__init__.py from .suba import A from .subb import B #script.py from a import A, B If you want to import local files you ha
by stop50 3y ago
it was always meant as an helper:
#a/__init__.py
from .suba import A
from .subb import B
#script.py
from a import A, B
If you want to import local files you have to edit the module path to include the current directory.
- akasakahakada 3y agoThis is flawed. I can have physics.core module and chemistry.core module. But if I add both into sys.path then import .core from physics directory, guess which core will be imported?
- stop50 3y agoYou usually get an import error. To import physics.core with an relative import you have to be physics/__init__.py