Hello!
I am using PYCHARM trying to do something I think is simple but I cannot get it to work!
Inside of PYCHARM I would like to create a new feature class then add it to the map. My code creates the feature class and I can see it in the Geodatabase but it will not show up on the map.
I have tried: addLayer(), addDataFromPath()
import arcpy
path_workspace = r"C:\Users\Strot\Desktop\ArcGIS Default Map\ArcGIS Default.gdb"
arcpy.env.workspace = path_workspace
arcpy.env.overwriteOutput = True
arcpy.env.addOutputsToMap = True
string_shape_name = "New_Layer_Shape"
aprx = arcpy.mp.ArcGISProject(r"C:\Users\Strot\Documents\ArcGIS\Projects\Test\Test.aprx")
mp = aprx.listMaps("Map")[0]
fc = arcpy.CreateFeatureclass_management(r"C:\Users\Strot\Documents\ArcGIS\Projects\Test\Test.gdb", string_shape_name, "POLYGON")[0]
fl = arcpy.MakeFeatureLayer_management(fc, string_shape_name)[0]
mp.addLayer(fl)
I have called Pro support and done all the searching I can, please help!