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, right-click a function name and select Navigate to File or Function.

  • Select Edit > Lookup File or Function, enter a full or partial file or function name, and then 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

Use 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

Right-click the breakpoint marker in the gutter and select the option you want.

Breakpoint marker context menu with management options

You can delete or disable the breakpoint, or select Properties to open the Modify BreakPoint dialog. To learn more about the Modify BreakPoint dialog, see Modifying a Breakpoint.

For more information about setting and managing breakpoints, see Breakpoints and dbreak.