First time here? Check out the FAQ!

Revision history  [back]

You can use Evaluate File in Python Shell to evaluate the file and the Python Shell will retain the state from the previous file as you describe above, as long as the Auto-Restart When Evaluate File option in its Options menu is disabled. Evaluate Selecting in Python Shell works similarly.

A similar option is to debug something, and use the Debug Probe at a breakpoint. It is a Python Shell that uses the runtime context of the current stack frame in the debugger.

With both you can select a range of lines in the editor and press the =+ icon in the top right of the Python Shell or Debug Probe to define an active range in the editor that you can reevaluate in the shell it's locked into by pressing the cog icon that will appear in the top right of the shell. This makes it easier to retry code as you're working on it.

The docs for this are at https://wingware.com/doc/debug/python-shell and https://wingware.com/doc/debug/debug-console