Detecting IDE mode #11626
Replies: 3 comments 1 reply
-
Depending on how the file is run (import vs. direct), you may be able to use |
Beta Was this translation helpful? Give feedback.
-
You can examine |
Beta Was this translation helpful? Give feedback.
-
I have an idea. Thonny represents running editor content with "magic" command The I could make Thonny to change |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way of programmatically knowing if im running code initiated through Thonny ie(IDE)... Right now, i have a constant variable where i set inIDE to true or false. If false, i do machine.reset() that i cannot do in IDE..
Being i have to rename the file to main.py to run automatically... I was thinking of just detecting the running script name. But, i cannot find the micropython way of doing that. Or maybe there is a better way.
In another words, if im in the IDE, i just re-initialize variables, but if I'm not in the IDE, i want to reboot/restart the device.
Beta Was this translation helpful? Give feedback.
All reactions