I am trying to remove joins from a layer using arcpy.
When I type in the python window the line:
arcpy.management.RemoveJoin("lyr1")
it works fine and the layer in the TOC does not have joins any more.
Then I tried in python that runs from a tool:
map1 = arcpy.mp.ArcGISProject("current").listMaps()[2]
lyr = map1.listLayers()[0]
arcpy.management.RemoveJoin(lyr)
It does not return any error but does not work (joins still exists).
Then I understood that I need to take the result from the tool:
updateLayer = arcpy.management.RemoveJoin(lyr)[0]
It is working but then I have to try to insert the layer to the original position (it is not 0 as my example it is inside some groups) and remove the original.
Is there any simple way to make it works in one command just like when I type it in the python window?
Thanks
after remove join, refresh TOC, see if it works.
arcpy.RefreshTOC()
I do not see this method in Pro
what do you mean by
@mody_buchbinder wrote:I do not see this method in Pro