'ModuleNotFoundError seen from module being imported from different folder on module being imported from same folder
Folks, sorry for the convoluted question title I have the following dir structure: projectfolder/source - main.py - module1.py - module2.py projectfolder/tests - test-module1.py - test-module2.py module2.py imports module1.py, test-module1.py works just fine, I added import sys sys.path.append("..") in test-module1.py and imported source.module1
but when I try to run test-module2.py(with the same import sys and sys.path.append(...)) I get File "../source/module2.py", line 1, in from module1 import * ModuleNotFoundError: No module named 'module1'
What am I doing wrong? Also this is my first python project I am building from scratch, what is the recommended dir structure? should main be in the projectfolder root? This is python3 so there is no need for init.py I think..
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
