I'm trying to do some work using Python 2.7 and ArcGIS Desktop 10.7.1 - I know old software. For some reason that I cannot figure out, my script adds the derived featureclass / shapefile and then when the script finishes, the layer is no longer in my TOC. I've tried many of the suggestions I have found on the internet and nothing will make it stick.
# Accessing the current open ArcMap project. mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] '''addLayer = arcpy.mapping.Layer(PATH + os.sep + "sel_GVILandscapePolygon.shp")''' '''addLayer = arcpy.mapping.Layer(r"E:\Junk\GVI_Query\sel_GVILandscapePolygon.shp")''' FnShp = PATH + os.sep + "sel_GVILandscapePolygon.shp" addLayer = arcpy.mapping.Layer(FnShp) arcpy.mapping.AddLayer(df, addLayer, "TOP") arcpy.RefreshTOC() mxd.save() Any thoughts?