To create some custom scripts, I first create what I can in Model Builder, then export to Python and add what custom code I need. One problem I've ran into is when passing other python code into a function. In Model Builder, it is easy to maintain the code block, but once exported to Python, any significant amount of code becomes difficult to read or document.I was curious if arcpy functions accept function names as parameters instead of the actual code. Then I could refer to a separate function in my script instead of stuffing all my code into a single line. This is what an exported function looks like:arcpy.CalculateField_management(ModelAirports_shp__12_, "Zoom", "calcZoom(!FlDaily!, !UseType!, !Part139!, !OEP35!, !Core30!, !Type!)", "PYTHON_9.3", "def calcZoom(flights, use, part139, oep35, core30, type):\\n if (oep35 == 1) or (core30 == 1):\\n return 10000000\\n elif ((oep35 == 0) and (core30 == 0) and (part139 == 1) and (type == \"AIRPORT\") and (use == \"Public\")):\\n return 262144\\n elif ((oep35 == 0) and (part139 == 1) and (type == \"AIRPORT\") and (use == \"Private\")):\\n return 262144\\n elif ((part139 == 1) and (oep35 == 0) and (type == \"AIRPORT\") and (use == \"Military\")):\\n return 262144\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Public\") and (flights >= 250)):\\n return 131072\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Military\") and (flights >= 100)):\\n return 131072\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Public\") and (flights < 250) and (flights >= 100)) :\\n return 65536\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Private\") and (flights >= 100)):\\n return 65536\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Military\") and (flights < 100)):\\n return 65536\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Public\") and (flights < 100)):\\n return 32768\\n elif (((type == \"SEAPLANE BASE\") or (type == \"GLIDERPORT\") or (type == \"ULTRALIGHT\") or (type == \"BALLOONPORT\")) and ((use == \"Public\") or (use == \"Private\"))):\\n return 32768\\n elif ((part139 == 0) and (type == \"AIRPORT\") and (use == \"Private\") and (flights < 100)):\\n return 32768\\n elif ((type == \"HELIPORT\") and ((use == \"Public\") or (use == \"Military\"))):\\n return 16384\\n elif ((type == \"HELIPORT\") and (use == \"Private\")):\\n return 8192\\n else:\\n return 0")
Easy to maintain in Model Builder[ATTACH=CONFIG]19251[/ATTACH]Was wondering if I could have something like this:arcpy.CalculateField_management(ModelAirports_shp__12_, "Zoom", "calcZoom(!FlDaily!, !UseType!, !Part139!, !OEP35!, !Core30!, !Type!)", "PYTHON_9.3", calcZoom(!Airports!, !Use!)
and then define calcZoom in a different part of the script. Thanks!Jay