Original Post
I have problem with calling a python function(in .py file) using C# I used PyPortalFun.py def fun(): print "hai" I included the Python.Runtime dll I have written C# code as using System; using Python.Runtime; namespace MainProgram { class PyTestClass { public PyTestClass() { PythonEngine.Initialize(); } [STAThread] static void Main(string[] args) { PyTestClass pyTest = new PyTestClass(); try { if(!PythonEngine.IsInitialized) throw new Exception("PythonEngine not initialized."); PyObject module= PythonEngine.ImportModule("PyPortalFun"); Console.WriteLine(PythonEngine.RunSimpleString("import PyPortalFun.fun()")); } catch(Exception e) { Console.WriteLine(e.Message); Console.Write(e.StackTrace); } } } } I used IroPython ie. I Installed in my system and I included the Python.Runtime dll as reference It is giving me the error File "", line 1 import PyPortalFun.fun() ^ Syntax Error : invalid syntax -1 In the Above program i am loading only the module name as pyPortalFun But i have a problem with calling fun() function in PyPortalFun.py from C# I need a solution for calling Python file functions in C# Code please send me c# source code for calling Python function Thanks.. K.V.N.Kumar Apollo Health Street Limited narasimhakumar_k@apollolife.com Hyderabad