Loop through selected features, works in Model Builder, but not in Python

Discussion created by unigisromy on Aug 14, 2011
Latest reply on Aug 22, 2011 by unigisromy

I have problems to get a loop for selected features running in Python. I built a workflow in Model Builder and exported the script to python. But in Python I get an error message if I try to run it. It says: Python cannot open a toolbox... I get the feeling that the function "iterateFeatureSelection_mb" does not work in py. I could not find it in the Desktop Help, too.
Could someone have a look on this. I am new to Python and don´t know how to write this as a loop.
Thank you!
Posted the code below and attached the model from Model Builder as an image.

import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")

# Local variables:
Solarpot_PotsdamPVend = "Solarpot_PotsdamPVend"
DSM_inside_PV_Punkt = "D:\\UniGIS\\MT\\Daten\\Bearbeitung\\MT_Scratch.gdb\\DSM_inside_PV_Punkt"
Geb_Geb_ID = "I_Solarpot_PotsdamPVend"
Punkt_inGeb__Geb_ID_ = "D:\\UniGIS\\MT\\Daten\\Bearbeitung\\MT_scratch.gdb\\Punkt_inGeb_%Geb_ID%"

# Process: Iterate Feature Selection
arcpy.IterateFeatureSelection_mb(Solarpot_PotsdamPVend, "", "false")
# Process: Clip
arcpy.Clip_analysis(DSM_inside_PV_Punkt, Geb_Geb_ID, Punkt_inGeb__Geb_ID_, "")