I have files that define global variables which I would like to use outside of the files, e.g. "func.py" containing:
def init():
global a
a = 5
If I import via "from x import *", then accessing the module's global variables like this does not work:
from func import *
init()
a
func.a
as neither a
nor func
are defined. "func" is listed in sys.modules.keys(), however.
I know "from x import *" is not exactly best practice, but how can I access the module's variables or the module object when using it?