Set breakpoints in Python code

Set breakpoints in your code to control execution.

Before you begin, launch your Python program. See Launch single-process Python programs or Launch parallel Python programs.

Python sessions support breakpoints only. Barrier points and evalpoints are not supported for native Python debugging.

Find the code you want to debug

If your script calls a function defined in another file or module, use one of the following methods to navigate to that code before setting breakpoints:

  • In the Source view:

    1. Right-click a function name.

    2. Select Navigate to File or Function.

  • From the menu:

    1. Select Edit > Lookup File or Function.

    2. Enter a full or partial file or function name.

    3. Select a result to open it in the Source view.

For more information, see Find files and functions using the Lookup File or Function view.

Set a breakpoint

Set a breakpoint by using one of the following methods in the Source view:

  • Select a line number in the gutter.

    Source view showing a breakpoint set by clicking in the gutter

  • Right-click a line number and select Set Breakpoint.

    Source view context menu with Set Breakpoint highlighted

  • Select a line in the Source view, then select Action Points > Set Breakpoint.

    Action Points menu showing Set Breakpoint

After you set the breakpoint, a marker appears in the gutter and the breakpoint is added to the Action Points view.

Action Points view showing a newly added breakpoint

You can also set a breakpoint in the CLI using the dbreak command. To learn more, see dbreak.

Manage a breakpoint

Use a breakpoint's context menu to delete or disable it or to view its properties.

  1. Right-click the breakpoint marker in the gutter to open its context menu.

    Breakpoint marker context menu with management options

  2. (Optional) Select Delete to remove the breakpoint.

  3. (Optional) Select Disable to temporarily disable the breakpoint.

  4. (Optional) Select Properties to open the Modify BreakPoint dialog.

For more information about deleting or disabling action points, see Deleting, Disabling, and Suppressing Action Points. For more information about the Modify BreakPoint dialog, see Modifying a Breakpoint.