Select to view content in your preferred language

Run custom toolbox from Python

1589
2
12-01-2011 12:26 PM
ModernElectric
Frequent Contributor
Greetings-
   I am still really new to working with a writing python script. What I have done is built a Data Model using Model Builder to export data out of an Oracle Database and bring it into a file geodatabase. I saved this model into a custom toolbox. What I am trying to do is to write a python script that will run the custom toolbox. Later - I plan on using Microsoft Task Scheduler to run this python script every night. I am not sure how to write this simple script to run my toolbox.

Custom Toolbox: CIS GIS Integration Tools.tbx
    Model: Water.CIS_Account_Data
    Model: Water.CIS_Service_Meters

Once I can get a script built that will run these models and/or the custom toolbox, I can do the rest on my own.

Thanks
Tags (2)
0 Kudos
2 Replies
ScottBlankenbeckler
Deactivated User
So you need something like...
arcpy.ImportToolbox("full path to toolbox/toolboxname.tbx")
arcpy.gp.toolbox = "full path to toolbox/toolboxname.tbx";
arcpy.gp.toolboxname(any parameters)
0 Kudos
ModernElectric
Frequent Contributor
So you need something like...
arcpy.ImportToolbox("full path to toolbox/toolboxname.tbx")
arcpy.gp.toolbox = "full path to toolbox/toolboxname.tbx";
arcpy.gp.toolboxname(any parameters)


Okay - like I said I really do not know much about Python and having a hard time finding anything online - such as examples on putting together a simple python script that will run a toolbox. Is there the ability to take a model from model builder and make it a tool - and than have python run that tool? If so - how do I do this and how do I write the script.

Thanks
0 Kudos