Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

List Toolbox then Run

$
0
0
I'm trying to figure out how to call a tool from another tool in python. In my python script of got something similar to the code below to get a list of all tools and I basically want the script to run them all automatically, but can't figure out how. So basically what is going to happen is someone will create a new tool in the toolbox and this will automatically be added to the process and run automatically without having to alter the code.

So my question is does anyone know how to automatically run a custom python tool? I can get a list of the tools in the toolbox, just not sure how to get them to run automatically.


Code:

import arcpy
# Create a list of the conversion tools#
tools = arcpy.ListTools("*_conversion")
# Loop through the list and print each tool's usage
e.g., 'Usage: merge <inputs;inputs...> <output> {field_mappings}'
#
for tool in tools:   
print arcpy.Usage(tool)


Viewing all articles
Browse latest Browse all 2485

Trending Articles