Here is the code structure:
my_project
├── __init__.py
├── main.py
└── util
├── __init__.py
└── utility.py
When I run a program via python3 my_project/main.py
.
I defined my_variable = 5
in my_project/__init__.py
.
I want to access this my_variable
at main.py
and utility.py
.
But have no idea how to do that....
I followed Can I use __init__.py to define global variables?, but it doesn't work for me (Cannot import project directory folder... it occurs an error : ImportError: No module named 'MY_PROJECT_DIR'
..
Could you help this out?