Imagine that we have a module one.py
with some global variable glob_var=object()
.
Also I have some other modules on different levels that import glob_var
using relative import, such as:
from .one.py import glob_var
from ..one.py import glob_var
from ...one.py import glob_var
I want to patch this glob_var
once, instead of patching three times for those modules that imports the variable. Is it possible to implement?
P.S. It's not necessarily to be a global variable. It can be a function or other object