i have created one python addin tool. which create some layers in Memory. at the end of the script it deletes the In memory layer. but such layer still remains in TOC with a broken link
how can i remove such layer in python ?
There is property isBroken - Returns True if a layer's data source is broken.
for layer in arcpy.mapping.ListLayers(mxd, "*", df): if layer.isBroken: arcpy.mapping.RemoveLayer(df, layer)