Python: Module from Project Folder Not Found in Package Folder

38 views Asked by At

I have the following project structure:

└── myProject
├── folder1 (package)
    ├── __init__.py
│   ├── file1.py
│   ├── file2.py
│   ├── file3.py
├── file6.py
├── file7.py

My friend added this package folder and I get errors. For example, "No module named file6.py" in file1.py that imports file6.

file6.py has the following line in the beginning that has no errors:

from folder1 import file1

But then file1.py has the following that is highlighted in red:

import file6

I was reading about file organization in Python and I suspect I need to specify my path so files in folder1 can "see" file6.py? I just feel like there's maybe an easier solution for this that I'm not aware of.

Read some articles on this topic but they showcased a different file structure. Read some similar questions here on StackOverflow, again I felt like it was a bit different from my issue and all the top featured questions were of different examples. One of the videos I watched introduced sys and specifying path. Decided to confirm by asking here.

0

There are 0 answers