Let's say we have a module m
:
var = None
def get_var():
return var
def set_var(v):
var = v
This will not work as expected, because set_var()
will not store v
in the module-wide var
. It will create a local variable var
instead.
So I need a way of referring the module m
from within set_var()
, which itself is a member of module m
. How should I do this?