I am working on a Python project structured with a src directory that includes various scripts and a forked library submodule. The project’s directory structure is as follows:
src/
├── script1.py
├── script2.py
└── doctr/
├── api
├── demo
├── docs
├── doctr/
│ ├── contrib
│ ├── datasets
│ ├── file_utils.py
│ ├── __init__.py
│ ├── io
│ ├── models
│ ├── transforms
│ ├── utils
│ └── version.py
|_________________
When trying to import modules from the nested doctr directory in the scripts like this:
from doctr.doctr.models import ocr_predictor
, I am encountering circular import errors.
Here is the typical error message I receive:
ImportError: cannot import name ‘VOCABS’ from partially initialized module ‘doctr.datasets’ (most likely due to a circular import) (src/doctr/doctr/datasets/init.py)
What i have tried until now:
- created an init.py file under the root of the submodule, did not help
- changed the name of root directory file, no chance withh that as well