I've done some searching, but nothing either works or applies to this specific case.
I have a file structure like this:
- my_project
- app.py
- my_project
- services
- begin.py
- data_analysis.py
- model_creation.py
- output.py
and I am trying to simply import each of the modules into the app.py
file so I can run a flask application, but I keep getting an import with only one of the imports (and it is always the same one). For example, if I ran python app.py
, I would get:
File "C:\Users\me\my_project\app.py", line 9, in <module>
from my_project.services.data_analysis import analyze
ModuleNotFoundError: No module named 'my_project.services.data_analysis'
I would think it has to do with relative imports or something, only its just one of the files that is having the issue, not several/all of the files. Any ideas on why I'm getting this error?
EDIT: modified project structure.
EDIT 2: this is unique as when running app.py, it still allows for things such as from .my_project.begin import start
or from my_project.model_creation import create
, but no relative or non-relative import will work for just the data_analysis.py
module.