how to call python code from C#

Peter Hansen peter at
Mon Jan 24 14:10:43 EST 2005

paritosh mahana wrote:
> How can I call python code from my C#  code. One thing is to make an
> .exe file of the python program and then try to call it from my C#
> code. But I don't like that idea. Is there any other way to do this.
> Like making a .dll file from the python code and somehow call it from
> C# program.But I couldn't find anything on this topic on the net.
> Actually my GUI is in C#  and rest part is in python, and i need to
> call python from my C# program. Please correct me if I am wrong
> anywhere.

You could use ctypes or the pywin32 package to provide your
Python code with an ActiveX interface.  Then you could just
use it via COM, like any other COM object.  Lots of references
available via Google if you want to learn more about this


More information about the Python-list mailing list