0

So I searched for dozen different tutorials and currently i am struggling with importing a file from different subdirectory. I am using python3. the folders look like this:

app
|-gui/
|   |-interface.py
|-src/
|   |-main.py
|-utils/
|   |-var.py

In main.py i am trying do import var.py with a two classes. This way: import utils.var. Horewer its the classic error: ModuleNotFoundError: No module named 'utils'. I tried all different combinations app.utils.var, var, utils, app.utils, nothing seems to work. Even tried relative imports like ..utils.var etc. What seems to be the problem???

Skiper
  • 1
  • 1
  • [Also Relevant](https://stackoverflow.com/questions/14132789/relative-imports-for-the-billionth-time) – Axe319 Dec 21 '22 at 19:24
  • Making cosmetic edits to closed questions is problematic. If the duplicate solved your problem, we are done. If not, your next edit should explain why this isn't a duplicate. – tripleee Dec 21 '22 at 19:25
  • get the main.py out of the `src` folder. then just use `import gui.interface` or `import utils.var` that should work – David Dec 21 '22 at 19:33

0 Answers0