Extending your scripts by including code from other files is a great way to simplify and structure programs. Instead of constantly reinventing the wheel for mundane tasks you can put code for them in a Python module or package once and then reuse that code in other scripts. This way you can focus on what’s important for your project instead of reimplementing trivial details. Even better by creating modules and packages you can share your code with others so they can benefit from it too!
With MicroPython you can import code in two ways. One easy way is from Python files on a board’s filesystem just like you would import Python modules & packages on the desktop. A second way is with ‘frozen modules’ that are baked-in to a build of MicroPython’s firmware and reduce the memory usage of a module vs. importing its raw Python source. This guide explores how to import modules & packages as both raw Python source files and frozen modules for maximum efficiency.
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, or even use Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for MakeCode, CircuitPython, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.