I have created a model in ArcGIS ModelBuilder and in a point of the process I insert a python tool (New Field) to create new field in a shapefile.

After that I want to use this new field in other tool in the same model. But I cannot use it because it is not created, it is not selectable in the available fields of the shapefile.

This image shows a part of the model where I create the new field and after I want to use this new field as a input in Pivot Table tool.

enter image description here

The New Field toll python code is:

def getParameterInfo(self):
    """Define parameter definitions"""

# First parameter

    param0 = arcpy.Parameter(
        displayName="Shape entrada",

    parameters = [param0]
    return parameters

def isLicensed(self):
    """Set whether tool is licensed to execute."""
    return True
def updateParameters(self, parameters):return
def updateMessages(self, parameters):return

def execute(self, parameters, messages):
    """The source code of the tool."""

camp= "GROUP_"
val= "Pix_Value"

    a= parameters[0].valueAsText

arcpy.AddField_management(a, camp, "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(a, val, "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

with arcpy.da.UpdateCursor(a, ["CODE2012",camp, val]) as cursor:
    for row in cursor:
        a= int(row[0])
        if a < 12100:
                    row[1] = "Residential"
            row[2]= 5
            elif a==12100 or a==12300 or a==12400:
                    row[1] = "Industrial"
            row[2]= 4
            elif a>12100 and a<12300:
                    row[1] = "Highway"
            row[2]= 6
            elif a == 21000:
                row[1] = "AnnualCrop"
            row[2]= 1
        elif a == 22000 or a== 25000:
                row[1] = "PermanentCrop"
        elif a == 23000:
                row[1] = "Pasture"
        elif a == 31000:
                row[1] = "Forest"
        elif a == 32000:
                row[1] = "HerbaceousVegetation"
        elif a == 50000:
                row[1] = "Water"
            row[1]= "No_clasified"

    del a
    del cursor`
  • 1
    Why can you use Add Field tool instead of python? Then this will be just another step in the model.
    – Bera
    Commented Sep 20, 2018 at 12:57
  • Can you post the content of New Field script?
    – fatih_dur
    Commented Sep 20, 2018 at 13:36
  • @BERA, I use python because I also fill the new field.
    – MikV89
    Commented Sep 24, 2018 at 12:22
  • 1
    @MikV89, there's also a Calculate Field tool available in Model Builder. See for example: How to Calculate fields for attribute table using ModelBuilder?
    – Andy
    Commented Sep 24, 2018 at 12:58

1 Answer 1


I seldom use ModelBuilder but one workaround I did use in similar case was to use dummy data to run the model up to the point where the field is added. This way you get the output from the add field tool (with the new field) to work with for the next steep.

When the model is complete you could change you dummy data to become a model parameter.

I only did that with tool from toolbox not with custom script so I don't know if it will work in your case

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.