I'm trying to run a project on google colab's GPU. Now like a typical project I have the project divided into sub-folders and various .py scripts. For an example, my project structure is like:
test_project
├── module1.py
├── module2.py
├── run
│ ├── run2.py
│ └── run.py
├── tools
│ └── tool.py
└── utils
├── util1.py
└── util2.py
The file I want to execute is run.py. Also, I have __init__.py (empty) files in all the folders.
Now, I know I can do sys.path.insert(1, 'test_project') and make this importable in colab notebook, but the problem is when I do something like
from test_project.module1 import foo
The import fails yelling
ImportError: cannot import name 'module1' from 'test_project'`.
Though, import test_project works.
Does anyone has any idea on how can I import all the packages and functions inside them just like I'd be able to import when test_project is installed with pip install?
Thanks.