Create a reload function for Python Addin modules

691
2
07-06-2016 09:03 AM
Status: Closed
Labels (2)
JohnDye
Occasional Contributor III

Python Addins have a terrible, awful, no good debugging process.

Code > Build > Initialize Client App > Install > Test > Repeat.

Honestly, it wouldn't be so bad if ArcMap didn't take so long to initialize that I could grow a beard while waiting for it to get a license and load a blank document. Python Addins need a process to reload the addin module, and by reload I mean completely, including the config.xml and image files from the assembly cache.

If this were possible, we could change the debugging process to:

Code > Build > Reload > Test

Why would we not want to do that? Additionally, if we could manipulate the config.xml and reload, that would bring new functionality to the table, including the ability to create semi-dynamic GUIs that could change based on a set of conditions, such as changing the image asset used for a button based on a specific condition.

2 Comments
RebeccaStrauch__GISP

John Dye , fwiw, I find the fastest way to refresh addins when developing (i.e. after a .updating a .py) without having to close/open Catalog/Map is to

  1. run (double-click) make addin.py
  2. Right-click in gray area or use the Customize-CustomizeMode
  3. Highlight your addin (although this might not be necessary)
  4. "Add from File" and select <your addin>.esriaddin file. 

That loads the update addin without having to close the ArcGIS Desktop session which saves a lot of time.  And it at least remembers this path if you are editing the same addin over and over.  So not a wonderful solution, but as often as I "repeat" when working on addins, saving 15-60+ seconds each time reduces my frustration.

If there was a way to create a button that enters the Customize Mode and loads from a file, that would make this process work, but I don't know if that is possible.

HannesZiegler
Status changed to: Closed

Thank you for your suggestion! Unfortunately, Python add-ins are no longer supported in ArcGIS Pro, and development on ArcMap has ended. There are no plans to support Python add-ins in ArcGIS Pro due to reasons outline in a statement provided for a previous idea when it was closed. To create add-ins in ArcGIS Pro, we provide the more powerful and flexible ArcGIS Pro SDK for .NET