.NET Assembly loses some methods when importing from one Python file to another (IronPython)

I have no idea if this is an IronPython problem, Revit API build problem or something else. Any information / ideas on what might be causing this is appreciated.

I understand that this is permissible by re-importing the same namespace, but I'm dying to understand why this is so.

The following is a brief example of what is happening. The images show the output of the RevitPythonShell console.

File1.py

import clr
clr.AddReference('RevitAPI')      # Contains Imports Autodesk.Revit.DB
from Autodesk.Revit import DB     # OK
DB.Element.Name                   # OK
DB.Element.Name.GetValue()        # OK: Method exists. As Expected

File2.py

from File1 import DB
DB.Element.Name                   # OK, Property Exists
DB.Element.Name.GetValue()        # *** Method DOES NOT Exist, Attribute Error is raised
from Autodesk.Revit import DB     # Re-import the same namespace again
DB.Element.Name.GetValue()        # OK:  Method Exists 

enter image description here

enter image description here

+4
source share

Source: https://habr.com/ru/post/1660641/


All Articles