Solve it yourself by referring to @Michael Scott Cuthbert
# re_direct.py import this_module import that_module wanted = None # caller.py import re-direct ''' many prerequisites ''' def imp_now(case): import re_direct if case1: re_direct.wanted = re_direct.this_module elif case2: re_direct.wanted = re_direct.that_module
then if in the caller, I call that imp_now, and then wanted to, regardless of whether you called in the calling file or another file that calls it, everyone will be redirected to this_or_that_module.
also, since I only import re_direct into a function, so you will not see this module anywhere, but only see what you want.
Thunderex
source share