Edit 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 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 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 change the location in Script Editor.

ヒント:

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