Threading in a Python Addin tool

Discussion created by johnjreiser on Dec 4, 2013
Latest reply on Dec 4, 2013 by JScheirer-esristaff
So, I put together a Python Addin tool to download aerial photography based on a user defined extent. It's available on GitHub here:

Now, the tool works just fine. One issue I have is that the downloading and extraction of the raster data is done in-process in a linear fashion. This causes ArcMap to become non-responsive for the duration of the downloads. Anything that blocks in Python blocks the entire application - just try entering the following into the Python console in ArcMap:
import time

And watch ArcMap hang for 10 seconds.

I started to look into threading, but simply taking one of the examples found on the web (one that simply prints time) and pasting it into the console resulted in ArcMap locking and needing a forced kill.

Is there some way - from within ArcMap - that I can pass a list of URLs to a module or a second script and wait for each to notify the main process that the download and extraction is complete? Essentially, can I "enable background processing" for Python - but without the overhead of launching another ArcGIS instance?