Hello team,
The structure of my python project is as follows :-
Main_project_directory
|
|--------dev
| |------data_preparation
| | |
| | ---Module_1.py
| | |
| | ---__init__.py
| |-------------------models
| | |
| | ----Module_2.py
| | |
| | ---__init__.py
| |-------------------Module_3.py
| |
| |-------------------__init__.py
|
|-------app
| |
| ---streamlit_app.py
| |
| ---__init__.py
|-------__init__.py
I am currently trying to perform absolute import in the script :- âstreamlit_app.pyâ to get functions and classes implemented in the modules present in âMain_project_directory/devâ, âMain_project_directory/dev/data_preparationsâ and âMain_project_directory/dev/modelsâ like:-
âfrom Main_project_directory.dev.data_preparation.Module_1 import func1â.
However, I am getting an error when I run the Streamlit application using the script :- âstreamlit_app.pyâ :-
ModuleNotFoundError: No module named 'Main_project_directory'
Traceback:
File "c:\eds\current_tasks\vqi\pull_requests\pull_request_6\Main_project_directory\ui\venv_2\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 554, in _run_script
exec(code, module.__dict__)
File "C:\EDS\Current_tasks\VQI\Pull_requests\Pull_request_6\Main_project_directory\ui\ui.py", line 33, in <module>
from ui_config import TEMP_DIRECTORY,PRE_TRAINED_MODEL_LIST,l_category_dict,SPLIT_DIRECTORY,l_train_args_dict,INIT_LR,LICENSES,INFO,HYPERPARAMS
File "C:\EDS/Current_tasks/VQI/Pull_requests/Pull_request_6/Main_project_directory/ui\ui_config.py", line 6, in <module>
from Main_project_directory.dev.models_pytorch.models import Models
Can someone please suggest how I can resolve this error ?