Import clr module

Hello everyone:
I am trying to use Sublime text as main editor instead the default dynamo’s one.
When I try to load clr, it gives error:
Module not found.
I installed Ironpython, but it doesn’t work either.
How to solve this problem.

Hello,

I use always this template
https://primer.dynamobim.org/10_Custom-Nodes/10-6_Python-Templates.html
Normaly i have no problem…

KR

Andreas

Thank you for replying.
Unfortunately this template solution is not what I asked for.
I am using external python editor (Sublime Text), I want to load Autodesk libraries, but it givr error : no clr module.
My quedtion is how to load clr into sublime text, and where it should be located?

@maxy_13 I am surprised that the editor shall make a difference here. Just to confirm, same is working fine with the normal editor in Dynamo? Which Alias/Dynamo version are you using?
Or are you using the editor outside of Dynamo?
Thanks,
GG

@maxy_13
if you want use IronPython in a Python IDE try Visual Studio Code (or PyCharm, or SharpDevellop) with IronPython (ipy) as interpreter
BUT you will not be able to launch the script outside Revit or Dynamo context

1 Like

Has anyone been able to add it as a Reference in Visual Studio?

I am trying having similar issues - stubbed the other elements which was working yesterday but today - not so much:
https://forum.dynamobim.com/t/edit-revit-dynamo-python-in-visual-studio-community/80552/2

what source did you find the python stubs?

This is how I got it to work in VSCode, but I haven’t tried to add them to Visual Studio yet.

You were right - the Stubs that were generated for Revit 2022 only .The CLONE of the GIT gtalarico/iron python stubs got me the stubs to get more if it resolved:

Revit Python in Visual Studio Revit Stubs 2022 for Python Revit Intellisense

September 01, 2022

Coding in python and fighting the #Autodesk Python basic editor with all the Case Sensitive syntax I decided to use Visual studio to code/debug. Problem is I was missing stubs. Grabbed them from the gtalarico GIT iron python stubs through a Visual studio Community 20220 CLONE in Visual Studio Community 2002:

Adding the references to Visual studio:

Tools>Options and:

Add Stubs Path to the top-level folder containing stubs(4) along with the Autodesk revit generated Stubs(5) and some GIT HUB Cloned Iron Python Stubs(6) and the general iron python stubs (7)(see below):

STUBS PATH:

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs

SEARCH PATHS:

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs\Autodesk

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs\DSCore

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs\IronPython

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs\Revit

C:\Users\rallen\source\repos\ironpython-stubs\release\stubs\RevitServices

NOTE:

%userprofile% didn’t appear to work in the settings an the Semicolon “;” was easiest to separate the values. Next check the semicolons were changed to linefeed/breaks for readability.

1 Like

I appreciate the detailed response; I’ll see if I can start using it in Visual Studio too.

1 Like