There is the following file structure.
/home/myusername/python/ │ ├── new_proj │ ├── __init__.py │ └── script.py │ ├── oth_project │ ├── __init__.py │ └── script.py │ └── __init__.py If in the script located in the new_proj directory try to import something from oth_project as follows (without adding additional paths to sys.path ):
from python.oth_project import script That, it is expected, an error:
ImportError: No module named 'python' Now, if before importing your module run
import ipdb then the import is done.
Only the following paths are added to sys.path :
'/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/myusername/.ipython' So, the question interests, ipython changes the import mechanism not only in its interactive mode? And can you rely on the performance of such imports for the future?
from ..python.oth_project import script(two points afterfrom)? - Ilia w495 NikitinSystemError: Parent module '' not loaded, cannot perform relative import. Secondly, I wanted to know what exactly changesipdbimports. - mkkikipdbcodeipdblook. - Ilia w495 Nikitin