I wrote some simple code that created multiple polygons using the Buffer tool. I will use it in a toolbox and therefore want the outFeatureClass to be automatically added to the current map.
The following code doesn't work. "outcome" is the outFeatureClass I want to add.
pw = r"C:\Users\Main\GIS\Data\ArcGISProject\ArcGISProject.gdb\outcome" aprx = arcpy.mp.ArcGISProject("CURRENT") aprxMap = aprx.listMaps("Map") aprxMap.addLayer(pw)
Running the code in the ArcGIS Pro Python command line I receive an error:
env.workspace for the Python file is set to