ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Accessing parameters within a Python toolbox

Within a Python toolbox, the main body of the tool is found in the execute method. This is where any analysis, conversion, and data creation occurs. Within the execute method you can call other tools and access ArcPy or other custom or third-party Python functionality.

The execute method itself has arguments to assist in dealing with parameters and messages, including a list of parameter objects and a messages object.

def execute(self, parameters, messages):

Within the execute method, each parameter's value can be accessed from the list using the valueAsText method. Other Parameter object properties can be accessed as needed.

Access parameter values using the parameter's object valueAsText method:

def execute(self, parameters, messages):
    inFeatures      = parameters[0].valueAsText
    outFeatureClass = parameters[1].valueAsText

Related topics

  • Writing messages in a Python toolbox
  • What is a Python toolbox?
  • Understanding script tool parameters
  • GetParameterAsText
  • GetParameter

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal