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

layer with broken link

how can i remove such layer in python ?

1 Answer 1


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)  

Link to Esri help

  • isBroken Property is not working Feb 11, 2016 at 8:39
  • is there any error or something?
    – user7172
    Feb 11, 2016 at 8:43
  • apologies, i did something wrong in script, its working fine, thanks a lot. Feb 11, 2016 at 8:57

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.