I have done loads of research. Most solutions are incredibly unnatural for this simple line of import code.
.
This is my example project (very simple):
.
TestImport
|_ folderB
... |_ moduleB (contains "SomeClass")
|_ folderA
... |_ moduleA (imports "SomeClass")
.
- When SomeClass is imported from moduleB into moduleA,
(moduleA.py:
from folderB.moduleB import SomeClass
) this error is encountered: " ModuleNotFoundError: No module named 'folderB' "
Run command: python folderA\moduleA.py
- If moduleA is moved to the root folder, the import works ( run command: python moduleA.py )
- I had marked folderB as source - same error. I marked both folders as source - same error. I therefore preferred to upload the project with no marked folders.