How can I retrieve the call graph of a function from Python source files?

advertisements

Do you know an integrated tool that will generate the call graph of a function from Python sources? I need one that is consistent and can run on Windows OS.


You could try with PyCallGraph
From its documentation:

Python Call Graph works with Linux, Windows and Mac OS X.

Otherwise, you can directly do it on your own, using the traceback module:

import traceback
traceback.print_stack()