task_depth

task_depth()[source]

Get the number of executing tasks currently on the stack. If the depth is 1, the calling function is the top-level task.