aprx = arcpy._mp.ArcGISProject("CURRENT")
content = aprx.activeMap
lyr = content.removeLayer("lakes")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 2003, in removeLayer
return convertArcObjectToPythonObject(self._arc_object.removeLayer(*gp_fixargs((remove_layer,), True)))
ValueError: lakes
I have been trying to remove layers from the map frame through python code, but the above errors have returned.
My idea is put this code on Calculate Value and use that in one Model Builder I wanted to create. May this possible?
Thank you in advance.
Best Regards.