Open mrunal093 opened 2 years ago
Hi @mrunal093, thanks for the report!
If I understood correctly this is your current setup and flashing method:
Is this correct?
If this is the case, it's because when a custom MicroPython is added to the settings Mu doesn't have a way to know if the MicroPython running on your micro:bit is the same as the hex file specified. For this reason it has to flash MicroPython every time the "Flash" button is pressed, and then it sends main.py
.
Flashing MicroPython means erasing all the micro:bit flash contents, so the library you've previously transfered is erased.
In this case what you need to do is first click "Flash" and then transfer any library via the "Files" panel.
Hi @mrunal093, did the instructions from my last message help?
What were you trying to do?
Calling a function from a user defined micropython file.
What steps did you take to trigger the issue?
I first move the robotbitV4.py file (which has the functions) using the file system. I then try to import it in the main file and call the functions in robotbitV4.py. Here is the main.py :
_### And HERE is the robobitV4.py_
What did you expect to happen?
The motor function should have executed. (It works in the online micropython editor)
What actually happened?
It shows import error on line 7. I think it actually resets the entire microbit and deletes the robobitV4.py file which then leads to the import error.
Operating System Version
macOs monterey 12.4
Mu Version
Mu 1.1.1
Other Info
I tried the same approach and code in the online editor (https://python.microbit.org/v/2) and it works fine.
Editor Log