AnsweredAssumed Answered

ApplySymbologyFromLayer not working from a script tool but does work in python window

Question asked by geoshoppet on Sep 29, 2020


import arcpy


currentMap = arcpy.GetParameterAsText(0)
buildingGBD = arcpy.GetParameterAsText(1)
series = arcpy.GetParameterAsText(2)

aprx ="CURRENT")
aprxMap = aprx.listMaps(currentMap)[0]
lyrFile = r"Z:\Data\Series_10.lyrx"


for series_num in series.split(';'):
   buildingFC = r"{0}\{1}\{2}{3}".format(buildingGBD,"Numbering", "Series_", series_num)
      #aprxMap.addDataFromPath(buildingFC), lyrFile, None, "MAINTAIN")
      arcpy.AddMessage("Series_" + series_num + " added")
      arcpy.AddMessage("Series number does not exist")


This is the script tool I've brought into my model builder tool but when I try to use instead of aprxMap.addDataFromPath (which does work) so that I can get the symbology, nothing gets added to the map frame. No errors are given and when I run the same in the python window it works. Is this a known bug or am I doing something wrong. I am using Pro 2.6.0