Before marking as duplicate to this one, please look at the details of my layout. I’ve gone through and this question does not address my issue and I haven’t been able to adapt the answer:
ImportError: cannot import name ‘…’ from partially initialized module ‘…’ (most likely due to a circular import)
Here’s my package layout:
clairvoyance
|-- __init__.py
|-- bayesian
| |-- __init__.py
| `-- bayesian.py
|-- legacy
| |-- __init__.py
| `-- legacy.py
|-- utils
| |-- __init__.py
| `-- utils.py
`-- visuals
|-- __init__.py
`-- visuals.py
5 directories, 9 files
Here’s the relevant files:
clairvoyance/__init__.py
__version__ = "2024.6.17"
from . import bayesian
from . import legacy
from . import utils
from . import visuals
clairvoyance/bayesian/__init__.py
from .bayesian import *
clairvoyance/legacy/__init__.py
from . legacy import *
clairvoyance/utils/__init__.py
from . utils import *
clairvoyance/visuals/__init__.py
from . visuals import *
In terms of relative imports, I have the following:
utils.py
Nonebayesian.py
hasfrom ..utils import *
legacy
hasfrom ..utils import *
andfrom ..visuals import *
visuals.py
hasfrom ..utils import *
I made sure there are no blatant circular imports so I have a feeling it has to do with the way I’ve structured my submodules.