Browsing index pages (3 articles)
↧
Having Trouble with Import Statement in Python
My current projects are structured like so.python/ __init__.py project_1/ __init__.py program_1.py project_2/ __init__.py program_2.py project_3/ __init__.py program_3.pyI wanted to import a class from...
View ArticleAnswer by Gerges for Having Trouble with Import Statement in Python
When using submodules, you need to use relative imports. In the example provided, importing program_3 from program_1 should be :from ..project_3 import program_3and then you can use the INFO class:...
View ArticleAnswer by Nicolas M. for Having Trouble with Import Statement in Python
The previous solution provides me the same error.I found a fix by using sys:import syssys.path.append('../')from project_3 import program_3...This way, you setup 'python' folder as reference (in your...
View Article
Browsing index pages (3 articles)