0

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")

.    

  1. 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

  1. If moduleA is moved to the root folder, the import works ( run command: python moduleA.py )  
  2. 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.
Solid T.
  • 11
  • 1
  • 7
  • Does this answer your question? [Sibling package imports](https://stackoverflow.com/questions/6323860/sibling-package-imports) – Elbek Mar 12 '21 at 06:36
  • I have received a promising answer. I will admit it/share it as soon as I'll do all the readthrough and apply one of the solutions. – Solid T. Mar 12 '21 at 06:40
  • In the meantime: NO `python -m` please, as `pytest` might be used further. NO strange hard-coded solution as well, please. – Solid T. Mar 12 '21 at 06:42
  • An answer from JetBrains is in the waiting for now. – Solid T. Mar 16 '21 at 08:58

0 Answers0