support
support copied to clipboard
[Bug] Multi mpy files always start with __main__
Describe the bug
The first (or only) module in a program is always called __main__ rather than the actual script name.
This is not to be confused with __name__ = "__main__", which is an entirely separate mechanism. This does not reference at our MPY6 metadata name at all.
Expected behavior We should use the actual name when compiling in Pybricksdev and Pybricks Code.
The firmware should then start the first script rather than looking for the one called __main__ and always finding it in the first spot.
Context
The name is needed to display it in the EV3 UI. We can't have all them called __main__.py 😄