pythonimportmicropythonpycom

Unable to import pycom module for LoPy4 board in VSCode


I'm a complete beginner and I recently got the LoPy4 development board as well as the expansion board. I am currently following the tutorial on changing the RGB lights on the board. I have been following the steps such as installing the Pymakr extension on VSCode and making the main.py and boot.py files. I am able to call import pycom in the Pymakr console and I am then able to turn off the heartbeat using pycom.heartbeat(False).

However, when I try the same thing by typing it in the main.py file, I get an error:

ModuleNotFoundError: No module named 'pycom'

There seems to be no issue with importing the other modules like import time or import random.

Anyone have any ideas what's the problem here?


Solution

  • Think of this as having access to two Pythons :

    Pymakr gives you : enter image description here

    to improve things like syntax checking for MicroPython I have created a few tools to make make the `Big Python' act more like the Micro Python.

    MicroPython Stubber

    and has been packaged as micropy-cli by Braden for simple use

    You can download and install the latest version of this software from the Python package index (PyPI) as follows:

    pip install --upgrade micropy-cli
    
    If applicable, you can test out a pre-release by executing:
    
    pip install --upgrade --pre micropy-cli
    

    After setup and a simple config the two pythons will get along much better. demo

    You'll still need to be aware which of the two Pythons you are dealing with, but it should help you.