I am trying to call a Python file in another directory from the same package. I know that there are many similar posts, but I can't seem to make it work.
My directory looks like this:
├── PackageName
│ ├── __init__.py (completely empty)
│ ├── file_1.py
│ ├── Folder 1
│ │ ├── file_2.py
│ │ ├── file_3.py
│ ├── Folder 2
│ │ ├── file_4.py
│ │ ├── file_5.py
I want any file be able to call any other file. So file_1.py can import classes from file_3.py which might rely on functions from file_4.py.
I would like to import things as such:
Within file_1.py
from Folder2.file_4 import class_4
within file_5 or file_3
from Folder1.file_2 import class_2
from file_1 import class_1
I've tried things like relative imports and adding __init__ to the other folders. I know I can use sys, but I would rather not.
Do I need to add something to my __init__ or is it something else completely?
Important
I would like to import like this regardless of which directory I am running from. For example, I would like to run file_5.py from the directory Folder 2.