Set a trace function for all threads started from the threading module and all Python threads that are currently executing. The func will be passed to sys.settrace() for each thread, before its run() method is called.
threading/settrace_all_threads
settrace_all_threads