I am using this code to add a feature from GeoDatabase dataset to an open MXD file
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\Streets.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers") targetGroupLayer = arcpy.mapping.ListLayers(mxd, "Main", df) addLayer = arcpy.mapping.Layer(r"C:\Data\NetMap.gdb\Streets\OneWay") arcpy.mapping.AddLayerToGroup(df, targetGroupLayer, addLayer, "BOTTOM")
This is somehow adding the
OneWay feature class to the
Main Group Layer at
Streets.mxd but I have to close the map and reopen it to see the data there.
I tried to refresh the TOC and Active view like (As it work in IDE inside the Current Map)
but it is not doing anything with stand-alone script and MXD. Can you please let me know if there is a way to do this?