The unofficial CircuitPython Reference

import

description

CircuitPython is designed in a modular fashion (as is Python) to reduce the memory size of programs. In every CircuitPython program it is therefore necessary to specify modules to access the classes and methods they contain.  The import keyword is used to access specific modules in Python and CircuitPython.

syntax

Import a module:

import <moduleName>

Access global variable from module:

moduleName.varibleName

Access method from module:

moduleName.methodName(argument)

methods

parameters

moduleName : case-sensitive name of a module or library.

returns

Returns the content of a module: classes, global variables, methods

example code

serial output:

see also: