I have seen many responses suggesting including an __init__.py
file in the subdirectory of submodules in order to import them as python package, but I can't get it working for my project. My project directory structure looks like this:
helm-2022
├── model
│ ├── __init__.py
│ ├── model.ipynb
│ └── torchModelSummary.py
├── preprocess
│ └── preprocess.py
└── utils
├── __init__.py
└── vis_utils.py
I want to import functions inside vis_utils.py
in the notebook model.ipynb
under model folder and preprocess.py
under the preprocess folder. I have already added empty __init__.py
under the utils folder. When I tried to import in model.ipynb
using from utils import vis_utils
, I still got No module named 'utils'
. I have also tried to import by including the top directory from helm-2020.utils import vis_utils
, but that gives me a syntax error because of the hyphen. I don't have permission to change the top directory name, so changing the hyphen is not an option. Thank you so much in advance.