Python Bundles not available in Revit 2024

I’ve pyRevit installed for Revit 2024 and 2025 and use my own extension.
As everybody know pyRevit will work in every installed Revit-version.

In Revit 2025 I see my custom extension and it loads my custom python modules.
I do not have to add any path in my Python-code.
pyRevit - Bundle Lib & bin

MyPanel.panel/
├── lib/
│   └── some_python_module.py
│
├── bin/
│   └── SomeRequired.dll
│
├── MyButton1.pushbutton/
├── MyButton2.pushbutton/
└── MyButton3.pushbutton/

I have a Dynamo-script with python-nodes. The nodes uses Python-functions of the loaded Python-module.
When I start my Dynamo-script in R25 it works 100%. (custom Python-functions are loaded/available)

When I start the same Dynamo-script in R24 it does not work. It gives: “importerror: no module named …”
So it can not find my custom Python-module and so it does not load my custom python functions.

In R25 I use the new Pythonnet3 package
In R24 I use IronPython 2.7 package

What can be the issue and whats is the solution?
The do not want to add any path in a Python-code. With pyrevit installed you have to do this.

1 Like

IronPython2.7 is based on Python 2 and will not have more recent packages and updates as it is now quite old and not maintained.
Try changing your engine to CPython3 which is the default or get the IronPython3 package.

Its likely on pyrevit to help here, as the issue seems to stem from there and cpython3 is not endorsed by the pyrevit community at this point. Seems to be issues with dyn scripts using cp3 not running via pyrevit as well if you check out their github.

I do not use CPython3, In Revit 2022-2024 I only work with IronPython2.7. Showdialog does not work with CPython3.

1 Like

@mrl
check your version of IronPython2.7 package

1 Like

Checked. I have already installed version 2.4.0

for 24 try 2.7 version 2.5 and for 25 version 3.2.1

@mrl

One solution would be to copy your py module (file) to the stdlib directory of the IronPython2 package.


Is your py module a common library for several Dynamo scripts?

An alternative solution would be to create “finder objects” to load local Python modules with sys.meta_path.append(finder) (directly in Dynamo script).

Here more information in Revit 2024 and 2025


Revit 2024 (and pyRevit installed): script with IronPython2.7-engine v2.4 gives an importerror.


Revit 2025 (and pyRevit installed): same script with PythonNet3-engine works.

Here is my code:

# -*- coding: utf-8 -*-
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

# Importeer eigen python-functies.
import _functies as JVZ

# Verzamel alle palen (17 - Paalfunderingen) in document
palen = JVZ.CollectPalen(doc)
OUT = palen

I have pyRevit installed. “_functies.py” is in network folder ‘lib’. (see also The AI workspace that works for you. | Notion)
All files are inside network-folders. There are no local files in use. Only Revit is on my computer installed.
What I want is that it works in R24/25 but I don’t know why it’s not working in R24.
I only see that file “_functies.py” is not found with IronPython.

@c.poupin : Yes, my py module is a common library for several Dynamo scripts.

This is just a guess, but you are probably using the CPython engine on PyRevit, which is also based on PythonNet3, and the modules preloaded in PyRevit (possibly linked to the “site” mechanism) are found in the PythonNet3 scope of Dynamo.

As a result, it does not work with IronPython2, whose scope and operation are different in Dynamo.

Be careful with this technique, as it could cause conflicts between the two Python engines (PythonNet3).

It would be preferable to reference the Python modules in the DynamoPythonNet3 scope via

  • sys.path.append(path_py)
    or
  • sys.meta_path.append(finder)
    or
  • by placing your py file in the Lib directory used by Dynamo.