What I often want to do is use the python console or run a specific piece of code in a specific program state. However, I do not know how to get to the program state I need for my code to run the way I want.
Usually what I used to do was run the debugger to a break point (so that I could get into the program state that I want). Then I would use the evaluate expression bar. However that seems really inefficient, especially because the evaluate expression bar is hard to use for multiline stuff and it seems meant for more about a single expression rather than testing the real code you intend to use. If I could instead execute, edit and re-execute cells after running an arbitrary program that isn't necessarily organized in a linear fashion (e.g. jupyter style), that would be ideal.
I know it is possible to execute cells (shift+enter or control+enter) and execute selected code (option+shift+e). However, I don't seem to know how to use those properly so that I can do what I want (specifically get to a program state so to test the code I want). So what I want to do is:
1) get to a specific program state that I want
a) run code in the console or python console in that program state
b) run code in cells (or selections) in that program state
How do I do that?
Or better stated: 1) get the program state I want 2) test new code (not just expressions)
Another issues I found was that it seem that this might require restructuring my code as jupyter like files...hopefully I can avoid that since refactoring is hard and a lot of times I am using code from other places that is NOT structured like that...