I am running the Calculate Field GP tool from the arcpy in ArcMap. When a row value is updated, it does not show up untill I use the Reload Cache tool (Table Options > Reload Cache). How do I refresh the attribute table automatically without using ArcObjects?

I have tried updating the definition query as @blah238 suggested Using python, how do you "reload cache" an opened Attribute Table, but this doesn't help. Resetting the data source is not an option because the feature class might be in the editing session and I don't want to lose the connection to the source data.

  • Are you using ArcGIS 10.1? If so are you using a Python Add-in or a Python script tool to run Calculate Field?
    – PolyGeo
    Commented May 7, 2013 at 7:59
  • 1
    Does it really matter? I am calling the Calculate Field GP tool from a Python Add-in, but the same thing is observed when running the GP tool from the Python window. Commented May 7, 2013 at 8:13
  • 1
    I always figure that if I am going to try and reproduce a problem, then the most likely way I will see it is if I do exactly (or as close as I can get to) the same steps in the same configuration as it has been seen before.
    – PolyGeo
    Commented May 7, 2013 at 9:37

5 Answers 5


You appear to be hitting a limitation of ArcPy, in the absence of ArcObjects.

The limitations of ArcPy.mapping have been broadly described here as:

Arcpy.mapping is not a replacement for ArcObjects but rather an alternative for the different scenarios it supports. ArcObjects is still necessary for finer-grain development and application customization, whereas arcpy.mapping is intended for automating the contents of existing map documents and layer files.

If @blah238's other suggestion of using ArcObjects from ArcPy is not an option for you, then you may be best to submit an ArcGIS Idea to have this functionality exposed to ArcPy. If you post a link to such an ArcGIS Idea here then I will be happy to vote for it.

  • Thanks PolyGeo, pity we cannot find a way to refresh the attribute table when calculating field values outside the editing session. Commented May 7, 2013 at 12:45
  • 1
    You might submit an enhancement request to ESRI tech support. I requested the ability to just have a button, menu option or F key to refresh the table to show changes without manually closing and opening. I was told the table should update on its own and the matter was closed as not locally reproducible. Usually they are helpful. I got the impression they are not even aware of the limitations.
    – John
    Commented May 7, 2013 at 21:37
  • I recommend doing both of the above but ArcGIS Ideas lets you monitor popularity & implementation progress much more easily than local support here.
    – PolyGeo
    Commented May 7, 2013 at 22:04
  • 1
    @johns, do you know that you don't have to close and open the attribute table to refresh it? The current way to do this is to click Table Options button > Reload Cache. Another thing that works is to run the Calculate Field operation in the editing mode, then the values in the attribute tables are updated immediately. Commented May 8, 2013 at 9:03
  • 1
    @Alex, thanks for the suggestion; it made me go back to test the issue further. I have used the reload cache but it failed/fails when I've added polygons in edit mode in layout view using an addin to get the layout extent. When in data view and I use the same addin, then the reload cache works. So it somehow involves the layout view.
    – John
    Commented May 8, 2013 at 14:18

This may or may not be useful to your for your specific workflow. I have found that if you change the selection on your layer then the attribute table updates too.

So I often use


Of course if you actually have something selected that you don't want to loose track of then this is no good. In that case you might select from layer where OID is in list of OIDs from currently selected features (basically change selection to whatever is already currently selected). This might take to long to be practically, I have never tried it in a real life scenario.


Have you tried:

arcpy.RefreshCatalog(target) # Set the target to your layers data source


arcpy.RefreshActiveView() # Refreshes the map


arcpy.RefreshTOC() # I highly doubt this will do anything, but you never know

I think one of these will work, but I know sometimes in ArcMap I have to manually close the attribute table then re-open it to see some edits. I'm not sure if closing and opening the table can be done with ArcPy, but that would also be an option.

  • Thansk, Cody, unfortunately, nothing of this works. Closing and opening the attribute table manually does the trick, however I am looking for something that would do that programmatically. Opening and closing attribute table is not available with Python either. Commented May 6, 2013 at 14:54
  • None of these are designed to refresh the attribute table.
    – Radar
    Commented Jan 10, 2017 at 17:10

This works:

    import arcpy

    definition_query = layer.definitionQuery
    # Change the Definition Query into something different
    if definition_query == '':
        oid = arcpy.ListFields(dataset = layer, field_type = 'OID')[0]
        layer.definitionQuery = '{} > 0'.format(oid.name)
        layer.definitionQuery = ''

    # Restore the Definition Query
    layer.definitionQuery = definition_query

I just ended up using a SWITCH_SELECTION twice before a RefreshActiveView...

arcpy.SelectLayerByAttribute_management (myLayer, "SWITCH_SELECTION")
arcpy.SelectLayerByAttribute_management (myLayer, "SWITCH_SELECTION")
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 30, 2022 at 6:55

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.