I have the following project structure:
python_project
├── module
│ ├── constants.py
│ └── __init__.py
├── scripts
│ ├── __init__.py
│ └── script.py
└── tests
├── constants.py
└── __init__.py
python_project
is in PYTHONPATH
.
module/constants.py:
VAR_MODULE = 25
tests/constants.py:
VAR = 17
I'm facing the following issue in script.py
file:
from module.constants import VAR_MODULE
works
from tests.constants import VAR
throws the following exception:
from tests.constants import VAR
ImportError: cannot import name 'VAR'
I know that there is no point in importing stuff from tests
directory, just wondering why this does not work. Is tests
directory excluded somehow?
Thanks!