Run a Python ( Pyrevit) Script from a C#-ribbon

Hi everyone,

For our company we have a C#-ribbonproject.
Wich we use to create a company-tab whichs houses our c# scripts (pushbuttons)
We can also run Dynamo-scripts from it.

I was wondering if it is possible to also trigger a Python script from this C# script.
Normaly we reference te dll or the dyn-file.
For dynamo we needed some extra works around.
But for Python i don’t realy know if it works.

Seems logical sinc dynamo also works with Python…

thx in advance for your kind feedback and input

Should be. Would require someone with knowledge of your current C implementation.

But the easy button is just to use ptRevit and let it to the work with your own extensions and bundles. Much simpler than dealing with a C interface and deployment.

pyRevit can run python, dynamo, C# scripts and VB scripts. One stop shopping and the menus are super simple to assemble and maintain…

Indeed, I have been using pyRevit for a while and have made some tools in it to.
But in this case we need to be able to deploy it also externaly (of the company).

If we would continue to program in python for this set of tools i assume we would need pyRevit, no matter how this script is triggered?
Or is there a way to acces Ironpython from the backend without the need for installing pyrevit?

Myself i’m only a beginner at programming, have done alot of dynamo but now starting to use python.

IronPythion ships and installs with Revit - for now. If you look at Revit’s Macro Manager and SharpDevelop, you’ll see Revt is still using IronPython 2.7.3. SO that’s all on par with pyRevit.
Next version - who knows? Dynamo has gone CPython but there has been push back on that and they have an option for IronPython. Hard to say what will ship with 2024.

The sample script that loas up with SharpeDevelop is worth taking a look at.

And ironPython is now at 3.4. So, you could skip pyRevit and the simplest interface would probably be through buttons activating python scripts in the Macro Manager.