I have create one of the project by using concept talk with other processes via a mechanism like COM for example : https://github.com/GraphBIM/RevitMCPGraphQL But the limit here is you need install an plugin in revit to listen event and send code execute from outside Revit