Import the library
The first thing your program does is tell Pybricks "I want to use the EXP6 library". Without this line, the hub does not know what MBC_EXP6 means and you get a NameError. EXP6 has only this one library, so there is nothing to choose.
- Download the library (save the file and keep its name): MBC_exp6_obj_Lib.py. The file name is
MBC_exp6_obj_Lib.py. - In Pybricks Code, click "Import a file" in the file panel on the left and import it into the same project.
- Do not rename the file (the program uses the name
MBC_exp6_obj_Lib), and do not put it in a subfolder. - Go back to your main program and type the lines below at the very top (marked ① in the program on the right).