Discussion created by wtgeographer on Apr 2, 2014
This looks ok to me.  I aim to let the user select a feature from first layer in only dataframe.  Then click the button on the addin tool bar.  Using the selection and the MAP_NUMBER field concatenate a path and add the appropriate feature class. Can anyone tell me why the layers are not being added.

import arcpy
import pythonaddins

class ButtonClass1(object):
    """Implementation for add_Layers_addin.button (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        #set the map document reference
        mxd = arcpy.mapping.MapDocument("CURRENT")

        #set the dataframe reference using the map document and the first data frame in the list
        df = arcpy.mapping.ListDataFrames(mxd)[0]

        #set the layer reference using the map document reference and the second layer in the list of layers
        layer1 = arcpy.mapping.ListLayers(mxd)[0]

        #create a search cursor to get relevant information about a parcel
        sc = arcpy.SearchCursor(layer1)

        #for loop to get the selected data
        for row in sc:
            #select the relevant fields to be put on the map
            ap = row.getValue("MAP_NUMBER")
            addLayer = r'G:\Texas\Potter-Randall\Database' + '\\' + str(ap) + '\\' + str(ap) + ".gdb" + '\\' + str(ap)
            arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")

        #refresht the active view

        #delete search cursor and row variables
        del sc
        del row