Editing a Python toolbox

A Python toolbox (.pyt) is a simple text file that can be edited in any text editor or Python IDE.

To edit a Python toolbox, right-click the toolbox and click Edit. When you finish your edits, your Python toolbox will be automatically refreshed when the editor is closed. Alternatively, to manually 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 edit 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