I have a project structured something like this:
project_folder
|--configuration
|--__init__.py
|--config.py
|--info.py
|--data
|--src
|--models
|--model.py
|--scripts
|--collect.py
|--tools
|--__init__.py
|--utils.py
|--process.py
|--train
|--trainModel.py
|--server.py
The config file in /configuration depends a list inside info.py so it is imported to the config file with import info
.
When I try to import the config file to the utils file in /src/tools with import configuration.config as con
, I get the error ModuleNotFoundError: No module named 'configuration'.
When I add sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
, I then get the error ModuleNotFoundError: No module named 'info'
instead of the previous one.
Is there a way to change the import statements in the utils file to resolve these issues?