I use USE_DUMMY which if it's set to True then a dummy is created for my module.
The question is: how do I set this variable (from an external module) BEFORE the import and/or other statements get executed?
a.py:
USE_DUMMY = False
def unvailable():
print 'not available'
if USE_DUMMY is True:
def dummy():
print "this function is a dummy"
unavailable = dummy
b.py:
import a
a.USE_DUMMY = True
Here it's already too late to set
USE_DUMMY = True
such that unavailable()
gets binded by dummy()
because the definitions were already executed.
If my question is not clear then I could elaborate it further ...