0

I'm not sure if there is a way to do this. I use TextWrangle to write my Python script and then use terminal to run it. So, I just run something like python code.py. In my script, I'm doing some data analysis where I create variables, but then I want to plot a few different things after running the script. So basically, is there a way I can enter a way to enter into a dynamic python mode so I can then plot different things or add more code. I would rather not just add more lines in the script since it takes time to run the script.

For example, at the end of the script, I have created the variables time, amp1, amp2, phase1, phase2, freq1, freq2. And I may want to plot different things together like time vs amp1 or any other combination. In terminal, if I type python it will enter into python mode where I could type out the entire script again and then plot different things and keep all the variables saved, but is there a way to keep all the variables saves locally after running the script?

TheStrangeQuark
  • 2,257
  • 5
  • 31
  • 58

1 Answers1

0

You can use pdb.set_trace() at the end of the script in order to enter into interactive debug mode. It is a bit of an abuse of the module, but it will let you write code and manipulate the current scope

Josh J
  • 6,813
  • 3
  • 25
  • 47