Python PostCommand to run C# add-in using ClientId

I have been trying to run a PostCommand using Dynamo Python similar to running a post command in C#

C# Sample of running a add-in using the ClientId.

string ClientId= "64b3d907-37cf-4cab-8bbc-3de9b66a3efa";
RevitCommandId id_addin = RevitCommandId.LookupCommandId(ClientId);
uiapp.PostCommand( id_addin );

Here I have written it using Dynamo Python, but get an error “expected PostableCommand, got str”

ClientId = "64b3d907-37cf-4cab-8bbc-3de9b66a3efa"
# Get RevitCommandId of PostableCommand
id_addin = RevitCommandId.LookupPostableCommandId(ClientId)
# Run PostableCommand
uiapp.PostCommand(id_addin)

Can this be done and if so what is wrong with the code above?

Hi Danny,

Here is an example of using postable commands to set design options. Maybe this is of some use?

Cheers,
Dan

1 Like

I’ve seen this example, therefore I know it possible to do. I’m trying to run a add-in which I have built using the ClientId. I’ve done it in c# using Jeremy’s example. The Dynamo Python gives me a str error. It seems the input type isn’t matching.

As it says in the error message: LookupPostableCommandId expects a PostableCommand, not a string.
The C# example you mentioned makes use of the LookupCommandId method - and that one does expect a string.

1 Like