I'm having problems changing layer symbology in ArcGIS Pro using Python. I have a feature class where the symbology has changed because the data in the fields used to define the symbolgy has changed. I'm trying to use Python to create a list of layers that need to be changed and then updating the symbology using the ApplySymbologyFromLayer function.
However; in Pro I am unable to make any changes using an IDE. If I try to use the Python window in Pro then it only updates the first target layer; but it updates that first layer for as many times as the number of items in the layer list. The only way I can update the symbology correctly is to use the Python window in Pro and rename all the target layers so they have different names.
Conversely, in Desktop I am able to create a list of layers and use the ApplySymbologyFromLayer with no problems; whether I use an IDE or the Python window.
Does Pro treat layer objects differently for some reason? I've noticed that using the geoprocessing method for importing symbology layers with the same name have a number appended to the end.
How can I make changing the layer symbology in Pro with Python work?
This is currently logged as a Bug I think (Bug BUG-000108497,Running the Apply Layer Symbology tool as a script in the Python window does not update the symbology in the map. ) The workaround (closing and reopening the project) does not seem to work as far as I can tell.
Mark Binder - I finally worked out how to do it a Python Toolbox, here's an example: