Creating a Python toolbox
There are two ways to create toolboxes in ArcGIS: script tools in custom toolboxes that we covered in the last recipe, and script tools in Python toolboxes. Python toolboxes were introduced in version 10.1 of ArcGIS and they encapsulate everything in one place: parameters, validation code, and source code. This is not the case with custom toolboxes, which are created using a wizard and a separate script that processes business logic.
A Python Toolbox is similar to any other toolbox in ArcToolbox, but it is created entirely in Python and has a file extension of
.pyt. It is created programmatically as a class named
Toolbox. In this recipe, you will learn how to create a Python Toolbox and add a custom tool. ...