I've created a model in ModelBuilder (ArcGIS Pro 2.7.2) and I'm trying to retrieve an attachment table created previously in the model using feature class to feature class. I'd then like to run the following python script to rename attachments in the table

fields = ['REL_GLOBALID', 'ATT_NAME']
featureClass = 'DFE__ATTACH'
update_dictionary = {}

with arcpy.da.UpdateCursor(featureClass, fields) as updates:
    for row in updates:
        if row[0] not in update_dictionary.keys():
            update_dictionary[row[0]] = 1
            update_dictionary[row[0]] += 1
        row[1] = 'Photo ' + str(update_dictionary[row[0]]) + '.jpg'
  • 1
    Where are you stuck? Is your model working as expected? If so, and if you're stuck on your script, what happens when you run the code that you've presented?
    – PolyGeo
    Commented Apr 13, 2021 at 0:11

1 Answer 1


If you want to run small amounts of python code as part of a workflow WITHIN an existing model you would typically use the model only Calculate Value tool.

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.