Symbology Layer Not Applying to New Feature Layer

Discussion created by vshah6 on Jul 13, 2017
Latest reply on Jul 13, 2017 by mitchh300

So my custom tool script first creates a new feature layer based on an existing feature layer using the MakeFeature_management function with just the certain fields I want showing. After that, the tool has a variable called inputLayer = to the raw string of the newly created Feature Layer. Here's what the script looks like so far:


import arcpy
import arcpy.mapping as map

mxd = arcpy.mapping.MapDocument("Current")

visibleFields = ["Field1", "Field2", "Field3", "Field4", "Field5"]
field_info = arcpy.Describe('Fiber Segments').fieldInfo
df = arcpy.mapping.ListDataFrames(mxd)[0]

for index in xrange(0, field_info.count):
    if field_info.getfieldname(index) not in visibleFields:
arcpy.Delete_management('Output Feature',"")
arcpy.MakeFeatureLayer_management('Input Feature','Output Feature Layer',"","",field_info)
addLayer = arcpy.mapping.Layer('Output Feature Layer')
arcpy.mapping.AddLayer(df, addLayer)

inputLayer = r'Output Feature Layer'
symbologyLayer = r'C:\pathway\Output Feature Layer symbology.lyr'

arcpy.ApplySymbologyFromLayer_management (inputLayer, symbologyLayer)


The issue here is that the symbology isn't applying to the Output Feature Layer when the entire script is run. If you run these lines individually in the python module in ArcMap, they run fine and apply the symbology. Any thoughts on this here?