I am working under a toolbox which shall at some point reapply saved symbology from the saved lyrx file.
And this line of code is not working even though the lyrx file is present and is correct with a correct path. What is the problem?
aprx = arcpy.mp.ArcGISProject("CURRENT")
active_map = aprx.activeMap
lyr = active_map.addDataFromPath(feature_path)
sym_name = os.path.basename(out_table)
sym_path = os.path.join(arcpy.env.scratchFolder, f"{sym_name}_sym.lyrx")
arcpy.management.ApplySymbologyFromLayer(lyr, sym_path)
Hard to tell without seeing the entire python script but one thing stands out to me. The line:
sym_name=os.path.basename(out_table) may not be quite right. Try:
sym_name=os.path.basename(feature_path)