I’ve had a couple people ask me why dynamo is able to work, remaining open and interacting with Revit. For an in-depth explanation of what is going on and why this works, see this post on the Building Coder. Then check out my implementation in the dynamoRevit.cs file from the repo. The trick is to open a transaction, subcribe to the OnIdling event, make the dynamo window a sub process of the main Revit process, then close the transaction and return to Revit whilst leaving dynamo running. It’s a bit complicated. As Jeremy mentions in his post, controlling Revit this way can be fragile which is why there’s a whole bunch of stuff I do in there to control the process flow, opening and closing of transactions, etc.