Python wild card import for DB

I’m working in Revit 2025.4 atm and have created several tools or upgraded older tools to work. Every so often for no reason I get an error message stating for example ‘BuiltInParameter’ or ‘FilteredelementCollector’ not defined etc. The fix is to go in and actually call the import. I thought I had read in one post but can’t find now about this particular year version where thing drift, is this related. Orkestra 2.0.1.5 is the current version we are using. Not sure whether your latest version addresses this issue?

@Greyboots thanks for reporting ! This is when building Python tools right ?

Yes that’s correct when building python tools

Ah so sorry responded to the message didn’t se the title of the thread :sweat_smile:.

We did have similar reports, for Cpython specifically. And indeed the right action is to explicitly import them .

We’ll try and investigate some more on this topic .

Hey again @Greyboots !

So dug deeper in this and here’s what’s up:

The Python 3 engine (pythonnet) doesn’t load a .NET namespace the way Python loads a normal module. Instead of pulling in every class up front, it resolves classes one at a time, the moment you actually name one.

This is a known pythonnet behavior, not really a bug in the tool. It works in the older engine (IronPython, Revit 2024 and earlier) because that engine is wired into .NET differently and can enumerate everything eagerly. The newer engine can’t do that cheaply, so it stays lazy.

So explicit import really is the best option here . We’ll make sure to make OkPy Agent extra aware of it! :smiley: It should help adress these issues faster!