If you load a script into IDLE and run it, then you can go to the shell window to continue to enter code. Say you defined a variable a=10 in the script you run inside IDLE, then in shell window you can use this variable like b=a**2. Then b=100.
The reason I am looking to achieve this feature is to predefine a bunch of useful functions and then once I am at MicroPython's prompt, I can easily run these functions. I thought I could write all the code in a script say mycode.oy and use "from mycode import *".
I am curious, whether this is the right way to go about it.
Also, how do I automatically run the "from mycode import *" at the starting point of the interactive shell?
Thanks.
How to achieve this feature available in IDLE
Re: How to achieve this feature available in IDLE
It just works. Anything you put in main.py gets executed, and when the program finishes or is interrupted, you get access to all the local variables in the REPL.
Re: How to achieve this feature available in IDLE
Great! Thanks. I was using ampy to upload files. I must have thought that uploading files makes the board reset (Arduino like). It's not. I have to ctrl + D to soft reset. It's all working now! Beautiful!