Python Modules make it easy to group related code into .py files that you can reference in your program, You do this by using an import statement that calls the file or specific parts of it.

This example includes a variety of emoji that represent images from microbit.Image, a class of the microbit module. Save this file as on your computer.

If you are developing a python module for the micro:bit, you can add magic header information that this is a microbit-module and give it a name and version number in the format major.minor.patch eg. emoji@0.1.0. This way the editor will add the module directly to the filesystem if it is dragged and dropped into the editor.

Adding by Drag and Drop

Now drag and drop onto the editor window and you will see a message saying that 'the "emoji" module has been added to the filesystem'. You will now see the module under your project files and you can call the module from your program.

Adding by the Project Files dialog

The FileSystem functionality built into the Python editor makes it simple to create and add an external module to be used in the program. To do this, select the Load/Save button from the menu.

This will open the files modal, look for Project Files and expand the dropdown button to reveal the files currently available to your project.

Choose Add file  to open  a file picker and select the file that you downloaded earlierThe file will now appear under your Project Files

You can now call the module from your program.

Calling the module from

In the text editor import everything from the microbit module and from your newly added emoji module

from microbit import *
from emoji import *

Now create a program that uses the emojis from your module in place of their Image class equivalents