addDataFromPath not adding outputs to map

1098
1
09-27-2022 10:14 AM
OwenKirkham
New Contributor

Hello,

When I run the addDataFromPath command, python prints "<arcpy._mp.Layer object at 0x000002658CF55948>" rather than adding anything to the map. I have 'arcpy.env.addOutputsToMap' set to 'True'

Here is a sample of my script:

layer_name = "layer"

Input_gdb = "gdb"

aprx = arcpy.mp.ArcGISProject(InputProject)
m = aprx.listMaps('Map')[0]

m.addDataFromPath(Input_gdb + "\\" + layer_name)

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

check the code examples

Map—ArcGIS Pro | Documentation

If the code is as you show it, then layer_name and input_gdb won't be known


... sort of retired...
0 Kudos