Quantcast
Channel: Having Trouble with Import Statement in Python - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer 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


Answer 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 Article


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 Article
Browsing latest articles
Browse All 3 View Live


Latest Images