I have been taking a script I found on Youtube to load several families into Revit at once and it keeps crashing with the error in the screenshot below:
I have narrowed down that “import System” is causing this. I am able to load families without “import System” however I would not be able to allow for handling of the dialog boxes that can pop up with Revit family loading. Also, “import System” is pretty boilerplate for the python nodes people showcase often. Are other people running into this issue? Any workarounds that you know of?
One other note, if I have “import System” in my python node, and then on a new line if I start typing “System.”, Dynamo freezes and crashes once I type the “.”. I am able to get around that by typing it elsewhere and copy-pasting my code into Dynamo. However I imagine this freezing is related to the same issue.
Before “import System”, I have tried to add clr.AddReference in a couple ways, but that hasn’t helped.
After looking into this myself, this seems like a .NET issue somewhere. Since Pythonnet is built in, maybe it is getting confused. Python script attached if you are curious. Youtube link is in the Python script if you would like to go down that rabbit hole. They wrote this in IronPython so I have taken some measures to update it to CPython3.
ContextMenu has been replaced by ContextMenuStrip in net Core
Since you are using Revit 2025 or 2026, I suggest using the latest PythonNet3 python engine which notably solves the .Net class interface implementation.
Hello! It looks like I only have CPython3 available. I am currently on Revit 2025, Dynamo Core 3.3.0, and Dynamo Revit 3.3.0. Do you think I need to wait until I get an update? Is there a workaround?
Install the correct version for your system from the Dynamo package manager. Read the description for the package carefully and ensure you select the right one.
Oh, I see. The PythonNet3 Engine is a package right now. I didn’t catch that earlier. Until it is in Dynamo by default, I may not realistically be able to use it. My company really wants to avoid the use of packages, because they need updating for each individual user and reduce stability.
It seems like “import System” isn’t going to work on the CPython3 engine. So the directions forward are use the PythonNet3 Engine package or avoid using assemblies/packages that use “import System”.
You should take a few to educate those who set this policy.
Three quick things towards that perspective:
This is a package produced by the Dynamo team, just like all the out of the box nodes you’re using.
The packages they deliver this way instead of including in core are often delivered this way so that the team can deliver updates faster than what you’d have available with an out of the box update and allow patching previous builds (i.e. this package was release around January of 2025 so after 2024 was released and likely after 2025 had reached the ‘pencils down’ point on new features. As such the Revit team wouldn’t be able to include it until 2027 product line).
Excluding packages en-masse means you’re getting about 10% out of your investment in Dynamo efforts as this increases the amount of work you have to do as each script you write in every graph has to be updated manually. At a minimum you should manage all custom scripts (such as the one in this thread) in your own office wide package.