Skip to main content

Edit a Python toolbox

A Python toolbox is a Python file with a .pyt extension that can be edited in any Python IDE or text editor.

To edit a Python toolbox from the Catalog pane, right-click the toolbox and click Edit. When you finish your edits, the Python toolbox is automatically refreshed when the editor is closed. Alternatively, to refresh a Python toolbox at any time, right-click the toolbox and click Refresh.

By default, the Python toolbox opens in Notepad. To change the application in which the .pyt file opens, click the Project tab, click Options, click Geoprocessing, and change the location in Script Editor.

Tip:

When a Python toolbox is refreshed, only the Python toolbox file is refreshed; any modules that are imported within the toolbox are not. To reload a module from within a Python toolbox, use the importlib module's reload function, which can be temporarily added.

import yourmodule
import importlib
importlib.reload(yourmodule)  # force reload of the module