AnsweredAssumed Answered

arcpy.AddJoin Not Working In ArcGIS Pro Script

Question asked by carkxg on Oct 25, 2019
Latest reply on Oct 28, 2019 by Dan_Patterson

I am trying to join a layer in an ArcGIS Pro map to a table using a scripting tool. The layer is called 'Heights', and is being joined to a table called 'Names'. The Python code below is working when run from the Python window within ArcGIS Pro. However, when I try to run it as a script from the Catalog Pane then the join does not happen, even though the geoprocessing detail does not throw up any error messages. Am I missing a step or does this just not work in ArcGIS Pro?

 

import arcpy
#Reference map document from within ArcGIS Pro
aprx = arcpy.mp.ArcGISProject('CURRENT')
map = aprx.activeMap
# Local variables:
Heights = "Heights"
toTable = r"C:\#workspace\Names"
# Process: Add Join
arcpy.AddJoin_management(Heights, 'LINK_ID', toTable, 'AI_LINK_ID', 'KEEP_ALL')

Outcomes