Skip to main content

Running code

In-memory vs File-based execution

Code blocks can be run in two modes:

  1. In-memory execution:
  • A subprocess is created, and the code string is imported directly.
  • Easiest way to setup an interactive application.
  1. File-based execution:
  • The code is written to a Python file. Execution occurs in a terminal subprocess.
  • Good for long-running scripts.

You can toggle between these modes by clicking the in-memory toggle button:

Running specific code blocks

There are two ways to run specific code blocks.

Clicking the run button

The first is to click on the code block's run button:

Using the keyboard shortcut

The second way is to select one or more sections and use the runCodeShortcut, which by default is:

  • Ctrl + Enter on Windows
  • ⌘ + Enter on MacOS.

Here's what two sections look like when they are both selected:

Running all code blocks

There are two ways to run all code blocks:

Clicking the Run button in the nav bar

Using the keyboard shortcut

The second way is to use the runAllCodeShortcut, which by default is:

  • Ctrl + Shift + Enter on Windows
  • ⌘ + Shift + Enter on MacOS.