I'm trying complete a script that will automatically create an annotation layer from a feature layer in ArcGIS Pro but am hitting a wall with the "Annotate Selected Features" code block (all information is on the ESRI site here).
Here's my code:
import arcpy
import os
import os.path
import sys
import datetime
arcpy.env.workspace = r"C:\Users\myname\Desktop\USACE\Working_Map\Working_map.gdb"
aprx = arcpy.mp.ArcGISProject(r"C:\Users\myname\Desktop\USACE\Working_Map\Working_Map.aprx")
m = aprx.listMaps("Map")[0]
lyr = m.listLayers("WGRES_Layer")[0]
arcpy.AnnotateSelectedFeatures_cartography(m, 'WGRES_Layer', "WGRES_LayerAnno 'Class 1'", 'GENERATE_UNPLACED')
Now the weirdest thing is the error message I get when I try to run this block; I get the message:
Traceback (most recent call last):
File "<string>", line 15, in <module>
AttributeError: module 'arcpy' has no attribute 'AnnotateSelectedFeatures_cartography'
Does anyone have any idea what's going on?
I get the same thing if I tried to run the tool as "AnnotateSelectedFeatures" instead (i.e. remove "_cartography" from the end).