← index #18642Issue #4925
Related · high · value 2.301
QUERY · ISSUE

main.mpy not run on boot

openby ancebferopened 2026-01-05updated 2026-01-05
bug

Port, board and/or hardware

ESP32-S3-WROOM-1-N16R2

MicroPython version

MicroPython v1.27.0

Reproduction

  • Compile main.py with mpy-cross.
  • Upload main.mpy to ESP32 filesystem.
  • Reset the ESP32.

Expected behaviour

Run of main.mpy on boot.

Can it be a documentation issue instead of a bug?:

"To fully optimise flash usage and memory consumption, you can copy pre-compiled main.mpy and/or boot.mpy files to the filesystem, or even freeze them into the firmware build instead."

Observed behaviour

main.mpy is ignored and REPL is started.

"import main" in the REPL executes main.mpy right.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

main.py not executing ESP32

closedby smith-scotopened 2019-07-16updated 2025-12-10
port-esp32

main.py is not being executed after power cycle. I have only two files loaded boot.py and main.py. My evidence that main is not being executed is as follows. The last line in boot.py sets a variable to True. The first line in main.py sets a different variable to True. After power cycling the board and logging into the REPL, and running the dir() command, the variable set in boot.py is output to the screen but not the variable from main.py. If this is not the correct place to raise this issue please let me know. Thanks.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied