Dynamo Script Starts itself again?

I’ve been using pyRevit to set up a ribbon with some custom dynamo scripts. It works great.

I just set up a Dynamo script that allows me to change titleblocks on sheets without opening the sheets. The script works great if I run it manually, but I get strange behavior when I use pyRevit to run it (has to be set to Automatic).

The Dynamo script uses Data-Shapes UI. When run, a box pops up and let’s the user check any sheets (via Sheet Number param from all used titleblocks in the revit file) to change the titleblock on and then gives a list of titleblocks loaded in the file to choose from. Click the submit button and it changes the titleblock. That much works fine.

Then the UI pops back up on its own. Weird.

Then I realized if I change the titleblock manually (not using the script) by just clicking on it and changing its type, the Dynamo UI pops up again.

So, I’m assuming since the script is set to automatic, it just keeps running itself again each time the titleblocks in the Revit file change.

Can any Dynamo gurus help me debug this?

Thanks!
Matt!
Capture|690x157