How to load a C# dll in python?


how can I load a c# dll in python?

Do I have to put some extra code in the c# files? (like export in c++ files)

I don't want to use IronPython. I want to import a module to Python!

9/7/2016 8:27:55 PM

Accepted Answer

This is to answer the second part of your Question Try making the DLL COM visible.

by using the


Ok IronPython is a .net implemenatation of the Python language The technology is going to use the DLR of the .net 4.0 when it arrives so IronPython will have more Dynamism (is that a word). (In english if you're a Python guru, you'll feel more at home when you use IronPython)

So you may well choose IronPython, if you do that you can skip the COM visible part. Since both (C# , Iron Python) are under .Net

Visit here for a sample C# DLL which is visible to COM

7/9/2013 8:06:23 AM

The package Python for.NET and the Python Implementation IronPython now work the same way.

Example for a C# DLL MyDll.dll:

import clr
from MyNamespace import MyClass
my_instance = MyClass()

See this post for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow