I came across a useful python debugging library the other day that allows you to print where a function is being called from:
from inspect import stack
def foo():
print(stack()[1][1:4])
def bar():
foo()
What this will do now is whenever foo() is called, it will also now spit out a message: