Skip to main content
Python scripts run in your browser, so the output appears right below the editor. Nothing needs to be set up.
1

Create a script

In the file tree, click the New file icon. Enter a name that ends in .py and click Create.
The Add Files dialog with the name analysis.py

A new Python file

The Run button and an output pane appear below the editor. The first time, the button stays disabled while Python loads.
2

Run it

Write your code and click Run. What the script prints appears in the output pane. You don’t have to save first.Files the script writes go into your project. A message tells you which, for example results.txt saved to your project, and the file appears in the file tree.
A script in the editor, its printed output below, and the message results.txt saved to your project

The output and a saved file

3

Stop a script

While a script runs, Run becomes Stop. Click it to interrupt the script. The output pane ends with Execution interrupted.
The Stop button and the output of a running script

A running script

Use a figure in your document

Plots have no window to appear in, so save them to a file. For example:
figure.png appears in your project, ready for \includegraphics{figure.png}.
figure.png open in the editor, with the message figure.png saved to your project

A saved plot

Read your project’s files

A script can open the files of your project by their path:

If something goes wrong

The script raises an error. The error appears in red in the output pane, after anything the script printed before it.
Printed text followed by a traceback in red

An error in a script

ModuleNotFoundError: No module named .... Only the packages built into Pyodide are available, and packages installed with pip cannot be used. NumPy and Matplotlib are among those available, and the message links to the full list.
A ModuleNotFoundError in the output pane

A package that is not available

Last modified on November 7, 2026