AnsweredAssumed Answered

ApplySymbologyFromLayer on ArcGIS Pro does not work

Question asked by GustavoRTE on Sep 17, 2019
Latest reply on Sep 18, 2019 by GustavoRTE

I am stuck with this issue for days, and yet I could not find a solution. 

 

Long story short, the "arcpy.ApplySymbologyFromLayer_management" simply does not work. The code runs without any issue, I can see the layer briefly locking on ArcPRO, but zero results.


My code:

workspace = "C:\whatever.gdb"
arcpy.env.workspace = workspace
ref_lyrx = r"C:\SimbologyIwant.lyrx"
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps('Map')[0]
layers = map.listLayers()[0]
layers2 = map.listLayers()[1]
arcpy.ApplySymbologyFromLayer_management(layers2, layers)

I also tried 

arcpy.ApplySymbologyFromLayer_management(layers2, ref_lyrx)

which uses the a layer file instead of a layer on the map. parameters

 

I refreshed, I ran the code with the map closed, added the optional p, tried all variations that I could think of. The code runs, but the symbology never changes.

 

Anyone has a sample code that works? Or any idea why my code has no results?

 

Thanks!

Outcomes