I am trying to add a module-level attribute to config file and want to do something like this..
# repo/__init__.py file
pass
# repo/config.py file
VERIFY_CERTS = True
and then, use this variable in other sub-modules
# repo/example.py
from repo.config import VERIFY_CERTS
def do_something():
if VERIFY_CERTS:
do something..
else:
do something else
Now, when I use this repo module in another script, I want to be able to do:
from repo.config import VERIFY_CERTS
VERIFY_CERTS = False
from repo.example import do_something
do_something()
Is it possible to do something like this?
Edit: It is definitely not a duplicate of Immutable vs Mutable types since, it discusses something about mutable and immutable datatypes whereas, this one is about having a module level attribute that could be remembered in a session. Modified variable names to clarify why I want to do this.