i´ve just found out that
rs.LayerIds() returns ids of layers which have been deleted.
def LayerIds(): "Return identifiers of all layers in the document" return [layer.Id for layer in scriptcontext.doc.Layers]
could you please add a setting to limit the returned list to layers which are still in the document ? eg:
return [layer.Id for layer in scriptcontext.doc.Layers if not layer.IsDeleted]