I have the following project structure:
xxx
├── xxx
| ├── settings
| └── tests
| └── __init__.py
| └── conf.py
| └── xxx.py
| └── utils.py
Those are the imports that I have in each file.
xxx.py
from xxx import utils, conf
from xxx.conf import BASE_DIR
conf.py
import os
import yaml
utils.py
import os
import shutil
from typing import List, Optional, Tuple, Dict, Union
import requests
When I run my app with
python3 xxx.py
I get the following error:
ImportError: cannot import name 'utils' from 'xxx' (/Users/yyyyy/workscpace/xxx/xxx/xxx.py)
When I run my test suite with pytest, I don't get any errors.
I have tried to change the import to (because those files are modules in my package):
import utils
import conf
In this case, I can run my app with no errors but I get the following error when trying to run pytest
ModuleNotFoundError: No module named 'utils'
What am I doing wrong?