When executing a tcl script, it is often necessary to print some results to make sure the process is correct, which means need writing some puts in the script.
Is there a way to start another tclsh and copy the current environment while the tcl script is executing, and test as many times as you like in the new tclsh without affecting the tclsh that is running the script.
You can create a new
interp
reter, provide all the needed procs, variables, etc. that you need (orsource
a script in it), and run code in it. Destroy it and repeat with a fresh one as many times as needed. Quick and dirty example of the idea: