2

This question already has an answer here:

I am trying to develop a Python Add-In for ArcGIS 10.3 and finding debugging pretty laborious. At the moment when I make a change to my python script I have to do the following:

  1. Close ArcMap
  2. Delete the "Python_Addins.esriaddin" file in my Default installation directory
  3. double-click the "makeaddin.py" file to create another "Python_Addins.esriaddin" file
  4. Install the add-in
  5. Restart ArcMap and start the project
  6. Test the tool

Surely, this can´t be the only way to test a python Add-In in ArcMap.

marked as duplicate by PolyGeo Jun 30 '15 at 11:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Step 2 is unnecessary, running makeaddin.py will overwrite your *.esriaddin. – PolyGeo Jun 30 '15 at 11:11
2

Unfortunately, it is not possible to "reload" the Python add-in while having the ArcMap session open. This is because the add-in is loaded into the program cache. So, the only way to see the changes done is to close ArcMap, install a new add-in and then start ArcMap (as you approach it now).

You should spend most of your time debugging and developing the add-in in your IDE, not in ArcMap. There are just some GUI components you could test in ArcMap; all the code can be tested fairly well within the IDE without involving the ArcMap.

To automate the process of ArcMap restart, I've used to execute an os command directly from the my IDE (I use Wing IDE). The command will close an ArcMap session, run the makeaddin.py and then start ArcMap session. Provided that you have a decent machine, the whole operation shouldn't take more than a couple of seconds (on mine it is about 5 sec or so). If ArcMap starts slowly, consider speeding it up by working with a new template or disabling external extensions and modules.

  • I am currently programming user interactions with the mxd and layer objects which makes ide testing impossible. I need to be able to check whether the functionality works in the ArcMAP user interface. – Robert Buckley Jun 30 '15 at 12:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.