Using an ArcPy script run from a toolbox, I want to import a feature class from a geodatabase into an ArcGIS Pro 2.1.2 map and then symbolise that layer based on a lyrx file stored on disk.
Here is a simplified version:
import arcpy, os aprx = arcpy.mp.ArcGISProject('CURRENT') m = aprx.listMaps('*') outputWorkspace = r"C:\Path\To\MyProject.gdb" arcpy.env.workspace = outputWorkspace out_fc = "fc_data" out_fc_p = os.path.join(outputWorkspace, out_fc) ref_lyrx = r"C:\Path\To\symbol_ref.lyrx" m.addDataFromPath(out_fc_p) out_fc_lyr = m.listLayers() arcpy.ApplySymbologyFromLayer_management(out_fc_lyr, ref_lyrx)
The script completes without error but no visible change is made to the symbology.
Is this a bug?
I've reviewed many similar questions but have been unable to resolve this.
I tried also first converting the fc to a layer using
arcpy.MakeFeatureLayer_management().getOutput() before adding to the map with
m.addLayer() and then using
arcpy.ApplySymbologyFromLayer_management() but get exactly the same outcome.