That’s probably what I will try do but it get much more complicated than that because what the button actually launches is a GUI like this one (anonymized to keep my client happy !)
This GUI keeps some internal states that are the result of some of the intermediate steps that must be feed to the later processing stages. The pain is that if I cannot look at the states of the variables in the GUI part, I have a hard time passing the right values (which can be geometrical objects) to the individual scripts (might need saving stuff to disk, writing logs just for that purpose, changing some module interfaces to add otherwise non-necessary input query capability, etc.).
I agree with Steve that we do not want the debug information to be ON all the time but being able to somehow attach the debugger to a running script or being able to start a script with a special switch like
_-RunPythonScript (MyScript.py, debug=True)
would be very helpful in situations like the one I just described.