In python is it possible to write a module which results in the following behavior:
from my_module import normal_stuff
# nothing happens
but
from my_module import normal_stuff, arcane_magic
# some code has been executed behind the scenes (i.g. redefining sys.excepthook)
I imagine that this could be done by parsing the importing script with the help of the inspect
-module but maybe there is a "cleaner" way.