Exporting a model to a Python script

The option to export a model to a Python script is valuable in helping you learn how tools and environments are used in Python, and often can jumpstart your development. After editing and completing the script, it can be added to a toolbox or model as a script tool and run as any other geoprocessing tool. To export a model to a script, follow the steps below:

LegacyLegacy:

Functionality to export models to JScript and VBScript has been removed from ModelBuilder at version 10.

Steps:
  1. From the menu in ModelBuilder, point to and click Model > Export > To Python Script.
  2. Click the Save in drop-down arrow and navigate to the location where you want to save your script.
  3. Type a file name for the script.
  4. Click Save.

Editing an exported Python script

There are instances when your exported model will not work. Take the following points under consideration when exporting a model to a script:

10/29/2012