Performing additional actions after pythonaddins.GPToolDialog() is called

Discussion created by rthopper on Oct 18, 2013
Latest reply on Oct 18, 2013 by johnmdye
ArcGIS 10.1

Let's say I have a python addin with a single tool.  The tool creates a new in_memory point feature class with a single point when the onMouseDownMap event occurs.  It then utilizes pythonaddins.GPToolDialog to launch the buffer tool.  The buffer tool uses the in_memory point feature as the input and then deletes it and removes it from the map when the tool finished.

This all works fine if the GP tool is completed successfully.  However, if the user chooses "Cancel" on the GP tool dialog, the tool quits but the in_memory point feature class that was created initially still remains in the TOC.

Anybody have a good workflow to remove that in_memory feature class from the map if the GP tool is cancelled instead of completed??