I'm trying to run a python file that imports a module using other modules in the grandparent folder. The file structure is:
directory_0
|
directory_1
| |
| directory_2
| |
| __init__.py (define the method A and import another method B from file_2.py)
| |
| file_1.py
|
directory_3
|
file_2.py (define the method B)
I want to run file_1.py
that imports method A defined in __init__.py
, and __init__.py
it imports method B from file_2.py.
I'm currently at /directory_0/directory_1/directory_2
to run the command python file_1.py
. It throws ModuleNotFoundError: No module named directory_3.file_2
How to make it run? and which path should I go to run this script (file_1.py).