However, import statements can also sometimes look like the following:
from library_or_module import name
from library_or_module.subpackage import name
from library_or_module import name as local_name
They can also have more complicated formats, such as including a try / except
block, etc.
The important thing to know is that an import statement will always include the
name of the module or library that you're importing.
Therefore, the best place to start is by reading through the import statements.
Here is an example import list for you to work with in this section. There is no setup or
other code shown here, as the purpose of this section involves only the import list.
import time
import board
import neopixel
import adafruit_lis3dh
import usb_hid
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
Keep in mind, not all imported items are libraries. Some of them are almost always
built-in CircuitPython modules. How do you know the difference? Time to visit the
REPL.
In the Interacting with the REPL section() on The REPL page() in this guide, the
help("modules") command is discussed. This command provides a list of all of the
built-in modules available in CircuitPython for your board. So, if you connect to the
serial console on your board, and enter the REPL, you can run help("modules") to
see what modules are available for your board. Then, as you read through the impor
t statements, you can, for the purposes of figuring out which libraries to load, ignore
the statement that import modules.
The following is the list of modules built into CircuitPython for the Feather RP2040.
Your list may look similar or be anything down to a significant subset of this list for
smaller boards.
•
•
•
©Adafruit Industries Page 69 of 263