Python 2.5 to 2.7:
#a.py:
def foo():
pass
#b.py
from a import foo
foo()
From foo()
, I'd like to know that it has benn called in the "b
" module. The only way I can think of right now is raising an exception, catching it and inspecting the traceback (going one level up). Is there a mare natural way of doing this?