I'm running into an issue applying a symbology layer (.lyrx) to a feature layer from an ArcGIS Toolbox. I am able to apply the symbology manually as well as through the ArcGIS terminal window without any issues. I have seen a number of posts with others having similar issues but not great resolution. Any suggestions on how to add the "raster_to_point_out_path" file to the ArcGIS project, then apply the symbology?
# Add the point feature class to the map
aprx = arcpy.mp.ArcGISProject("CURRENT")
active_map = aprx.activeMap
# Apply symbology from .lyrx file
symbology_lyrx = r"Modeling.lyrx"
# Add the point feature class to the map
added_layer = active_map.addDataFromPath(raster_to_point_out_path)
arcpy.AddMessage(f"Layer added to map for Dir_Arrow{value}")
# Apply symbology from .lyrx file
symbology_layer = arcpy.mp.LayerFile(symbology_lyrx)
arcpy.ApplySymbologyFromLayer_management(added_layer, symbology_layer)
arcpy.AddMessage("Symbology applied from the .lyrx file")