All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Posts: 52
Joined: Mon Feb 19, 2018 6:31 am vs

Post by ajocius » Sat Jan 19, 2019 5:32 pm

Is there any general logic on what to keep in each file? Both files are executed during startup. I have seen examples where wifi connection is coded in, but also seen it in, tried both options and it worked fine. Same with MQTT parameters (user name, password, ip address, etc), some place them in , some in Is there any benefit of putting into one file vs the other?

User avatar
Posts: 3202
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: vs

Post by dhylands » Sat Jan 19, 2019 7:28 pm

The way that I normally think about this is that is used to configure your bootup and is my main program.

Some things, like configuring the USB mode, or setting the name of the main script (which defaults to, but can be changed) can only be done in

Code which is introduced in is availaed at the REPL without having to import anything, whereas code from isn't. I think of it as is sourced where is imported.

Post Reply