AnsweredAssumed Answered

Run model builder model from Python with variable for model name

Question asked by dvanriel on Oct 22, 2015
Latest reply on Oct 22, 2015 by lpinner

I am writing a Python script to run a model builder model based off of variables.  I can get all the way to calling the model itself but then I get the error message: unsupported operand type(s) for +: 'builtin_function_or_method' and 'str'.


When I use the actual model name (arcpy.StreetNameListingModel_TBX()) it works but I want the model name determined by a variable.  Is it possible?  I have tried with quotes in different places, combining the needed text before using, but none of it works.




import arcpy

##Set folder location of the Toolbox.
ToolboxFolder = r"C:\GIS\Street name listing"

##Set the name of the Toolbox.
ToolboxName = "Street_Name_Listing"

##Set the model name.
ModelName = "StreetNameListingModel"

##Call the Toolbox.
arcpy.ImportToolbox(ToolboxFolder+"\\"+ToolboxName+".tbx", "TBX")

##Call the model.