I am using ArcMap 10.4.
I’ve been trying to implement a python add-in that runs when Arcmap is opened.
When the script does run it joins a layer with a feature service layer. I have everything working if you run it in the Arcmap python window. When I take the next step and make it into an add-in it will not work. I added a sleep time to it to delay running until arc is fully open in hopes that it would fix the problem, but no such luck.
I performed a test with a text file and it will update the text file when arc is opened so I know that it is indeed running, it’s just not doing what I want it to. Any ideas?
Here is what I have:
import arcpy import pythonaddins class RoadJoin(object): """Implementation for RoadJoin_addin.RoadJoin (Extension)""" def __init__(self): # For performance considerations, please remove all unused methods in this class. self.enabled = True def startup(self): pass # Local variables: Roads_2015 = "Roads 2015" Roads_2015__2_ = Roads_2015 All_roads = "private\\transportation_FA_wa\\All roads" time.sleep(30) # Process: Add Join arcpy.AddJoin_management(Roads_2015, "BRUCE_ID", All_roads, "BRUCE_ID", "KEEP_ALL")