Understand Python Path — Import Variable From __init__.py (update)
This is an update for How to (Python) get value from __init__ in same dir | by 洪健翔 Hung, Chien-hsiang | Aug, 2022 | Medium. Make sure you have read the previous one. Let’s get started!
Photo by AltumCode on Unsplash
Dir Structure:
—ModuleName
| — __init__.py
| — bar.py
__init__.py
:
|
|
bar.py
:
|
|
This way you can successfully import the var from __init__.py when both testing and production using.
original q: Can I use __init__.py to define global variables?
Contact Me: Hung, Chien-Hsiang (chienhsiang-hung.github.io)