Does a way to interoperate in C# and Python exist?
I know and have used IronPython (obviously, it became really sweet with the dynamic keyword), and it allows to interpret Python scripts inside a C# application.
But I want this Python script to access C# classes and methods. I know, for example, this can be implemented using boost::python and C++, but how should I (if it’s possible) do it with C#?
Thanks.
Well you could compile your C# code to a DLL using
cscand use ctypes to access the DLL from your script but if you can use IronPython, then that’s the route I’d go with.Using C# modules from IronPython is as simple as a call to
clr.AddReference. For example, here’s a script to make your computer talk to you (taken from the IronPython Cookbook)