import arcpy
import os
# The ArcGIS Project is used to build paths from the defaultGeodatabase and
# homeFolder using os.path.join
# Reference the CURRENT project with ArcGIS Pro open, or point to an .aprx on
# disk
prj = arcpy.mp.ArcGISProject("CURRENT")
arcpy.CopyFeatures_management(os.path.join(prj.defaultGeodatabase, "study_sites"),
"in_memory/tempSite")
# Create a variable to reference the LYRX folder
lyrxFolder = os.path.join(prj.homeFolder, "LYRXs")
arcpy.ApplySymbologyFromLayer_management("in_memory/tempSite",
os.path.join(lyrxFolder, "Site4.lyrx"))