Documentation for python API in mBlock


I’m trying out the python mode in the latest version of mBlock 5. It looks like a promising way to get started on learning python.

Is there any documentation for this API? At the moment I have to create a sample script and view the code to see the syntax. Will you make the source code available if there is no documentation?

I was also wondering if it is possible to import your own python modules for use in mBlock?


I just found some documentation at

Currently it looks like it is in Chinese but there is a reasonable amount there.

I would still like to know if you can import custom python modules :slight_smile:


Ah, you’ve found the little secrets.

Supporting Python module is an interesting topic. The Python in mBlock is a virtual environment in the browser, and we are considering how we can extend it. Currently there are two ways that may likely appear in the extension system: using python modules, and using Javascript-Python bridge.

That means, in the future, you may write pure Python modules (that means, complex libraries like numpy, tensorflow or pandas may not apply), or write Javascript functions and provide a Python API.