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)