When you start creating complex and reusable scripts, you often get a situation when various procedures defined in various scripts are calling each other.
When an error occurs, it’s often very useful to know the calling stack: the order of which procedure called which procedure called which procedure, down to the procedure that caused the error. This can help identify the conditions that give rise to the error.
To show the stack trace window, in the Script Editor select History > Show Stack Trace.
When an error occurs, Maya displays the file’s stack trace in a window and an error message in the Script Editor.
You can also turn stack tracing on or off in MEL using the stackTrace command:
// Have the stack trace window show up on script errors stackTrace -state on; // No stack trace stackTrace -state off;