AnsweredAssumed Answered

Importing models from a toolbox toolset

Question asked by M.Engelsma on Aug 21, 2013
Latest reply on Oct 2, 2013 by M.Engelsma
Hi there,
In arcgis 10 I'm trying to import a model that's located in a custom toolbox with the arcpy.ImportToolbox method. This is working ok as long as the model is located in the toolbox root but once I put the model in a toolset I'm getting an error:
AttributeError: 'module' object has no attribute 'TestModel_Database'.

Since models in toolbox need to have unique names I assumed the location in a toolset didn't matter but is there some additional info I need to add to the function? I can't seem to find any reference to importing toolsets on the forums, help sites or internet so any info is appreciated.

Below I pasted a piece of code I'm using to test importing a model that creates a featureclass and adds a field.

import arcpy  arcpy.env.overwriteOutput =1  arcpy.ImportToolbox(r"S:\GEOINFO\11_Peilgegevens\PeildataVerwerken")  Parameter01 = "xxTest" Parameter02 = "Testfield"  arcpy.TestModel_Database(Parameter01, Parameter02)

As a bonus question, we're going to upgrade to Arcgis 10. or 10.2 in a couple of months, is this method changing in higher versions? I found a lot of references to python toolboxes so I'm just wondering.

Cheers and thanks in advance for any advice,