I have created a dll using C#. How do use the dll in IronPython. I have tried to add the dll using clr.AddReference("yxz.dll")
. But it fails. I have tried placing the dll in the execution directory of the IronPython script. Still it fails stating that "Name xyz cannot be found" while trying to refer the dll.
import clr
clr.AddReferenceToFileAndPath(r"C:\Folder\Subfolder\file.dll")
is the simplest way as proposed by Jeff in the comments. This also works:
import clr
import sys
sys.path.append(r"C:\Folder\Subfolder") # path of dll
clr.AddReference ("Ipytest.dll") # the dll
import TestNamspace # import namespace from Ipytest.dll