2
Vote

Keep execution context of completed script available in Debug Interactive

description

Would be nice to keep execution context of completed script available in Debug Interactive. This is often useful while developing numerical computation/visualization scripts to prototype the next step in interactive mode before incorporating it into the script.
See for example how it works in IDLE (and most other Python IDE's I've tried)

Admittedly, pretty much the same effect could be achieved by adding print("done") as at the last line of the script and setting a breakpoint on it, but it just feels unnatural that I have to do that...

comments

Zooba wrote Feb 27 at 3:42 PM

Does 'Debug->Execute in Python Interactive' work for you? It will reset the interactive window each time you do it, but it leaves the results of the script.

You can open a regular interactive window and type import my_module_name (or reload(my_module_name) if you've imported it before and haven't clicked reset).

If you need to debug the script and still have everything left at the end, you can "Enable attaching to interactive window" through 'Tools->Options->Python Tools->Interactive Windows', type "$attach" in the interactive window and then import my_module_name.

VadimC wrote Feb 27 at 7:25 PM

That helps, thanks!

I would still ask you guys to consider this or similar feature for the next version because with these workarounds I need to spend extra mental effort deciding whether I want debugging or REPL after completion or both.