Several files: modules and packages
A widget can hold more than one file. They are written into Pyodide's
filesystem before the run, next to the entry point and on
sys.path, so ordinary import works — flat
modules, packages with __init__.py, and plain data files
you open(). Pick a file with the tabs; ▸
marks the one Run executes.
A package, a module, and an entry point
Edit
geometry/shapes.py — say, make Rectangle.area
return 0 — and press Run. The module cache is cleared between
runs, so the edit takes effect immediately instead of Python serving the
copy it imported last time.
Tracebacks name the real file
The entry point is executed under its own path, so a failure inside a
package points at geometry/shapes.py and its line number —
not at <exec>.
Not just Python files
Anything in the file list lands on disk, so open(), the
csv module, and relative paths behave normally. The working
directory is the widget's own folder.
Files are per-widget but the runtime is still shared: all three
playgrounds on this page use the same Worker, and each run rewrites its
own file set first. Completed: