Is there a way to call a function each time another function is called?

Viewed 34

Say I have the following code:

def foo():
    print("I'm a function")

def bar():
    print("Me, too!")

Is there an elegant way to call a third function each time any function in this script is called? I would like to avoid having to call the third function from within the function body as my actual script contains a lot of functions, so some global way would be nice in order to avoid excessive repetition.

0 Answers
Related