I am trying to test Python modules. Currently, the file structure is like the following displayed:
project
├── __init__.py
├── __pycache__
│ └── __init__.cpython-37.pyc
├── p.py
├── package1
│ ├── __init__.py
│ ├── __pycache__
│ ├── module1.py
│ └── module2.py
└── package2
├── __init__.py
├── __pycache__
└── module3.py
In the module3.py, I would like to import the functions defined in module2.py. I believe I just need to use from package1.module2 import function_name
. However, that doesn't work and the error is ModuleNotFoundError: No module named 'package1'.
BTW, I am using Python3.6 for the testing.