I have the following command:
a = imp.load_source("a", r"some_path\some_source.py")
and so a is a module object from which I can access and run all functions inside some_source.py. Is there a way in python to accomplish that additional functionality will run before using any of some_source's functions but without changing some_source.py? For instance if some_source.py has functions foo1, foo2 ... foo100, then I want the command
a.foo5()
to actually execute:
imp.reload(a)
a.foo(5)
and this should be applied to all 100 foo functions.
Just to be clear, I want the added functionality to happen simply by running the same command as everybody in my team are used to -
a.foo5(). I don't want them to have to create some sort of class or call a different method than what they're used to.