Hi,<br>I saw this somewhat old thread on an IronPython forum (Link: <a href="http://mail.python.org/pipermail/pythondotnet/2006-June/000504.html">http://mail.python.org/pipermail/pythondotnet/2006-June/000504.html</a>, also shown below.) and I am trying to do exactly the same thing as the person who originally posed the question:
<br>I would like to run .py files from within a C# program, using pythonEngine. The .py files contain several python functions that I would like to be able to call.<br><br>I was wondering if the newer versions of IronPython have fixed this problem and if there is now a solution for what I&#39;m trying to do?
<br><br>Also, is there somewhere that I might find documentation as to the functions/API for pythonEngine?<br><br>Thanks,<br>Dylan<br><br><br>-----------------------ORIGINAL THREAD-----------------------------------------------------------------------------------------------------------
<br><pre>Have you tried using the PythonEngine.RunString (not <br>RunSimpleString) method? <br><br>Still not as convenient as having a RunFile, but that <br>should do what you need for now.<br><br>-Brian<br><br><br>&gt;<i>
 -----Original Message-----<br></i>&gt;<i> From: <a href="http://mail.python.org/mailman/listinfo/pythondotnet">pythondotnet-bounces at python.org</a> <br></i>&gt;<i> [mailto:<a href="http://mail.python.org/mailman/listinfo/pythondotnet">
pythondotnet-bounces at python.org</a>] On Behalf Of LIVERNAIS Sylvie<br></i>&gt;<i> Sent: Thursday, June 01, 2006 11:08 AM<br></i>&gt;<i> To: <a href="http://mail.python.org/mailman/listinfo/pythondotnet">pythondotnet at python.org
</a><br></i>&gt;<i> Subject: [Python.NET] How to run a .py file from C#<br></i>&gt;<i> <br></i>&gt;<i> Hi, <br></i>&gt;<i> <br></i>&gt;<i> I&#39;m a newbie in C# and python and try to run a .py file from <br></i>&gt;<i> a C# program. 
<br></i>&gt;<i> <br></i>&gt;<i> I tried the same thing from a C++ program using <br></i>&gt;<i> PyRun_SimpleFile and in the console, I could see the python <br></i>&gt;<i> execution (the print from python).<br></i>&gt;<i>
 <br></i>&gt;<i> Using Python.Runtime.dll from Python.NET, I saw that such a <br></i>&gt;<i> fonction is not available, and should use <br></i>&gt;<i> PythonEngine.ImportModule and PythonEngine.RunString or <br></i>&gt;<i>
 PythonEngine.RunSimpleString. The thing is that it only works <br></i>&gt;<i> for a command written over one line, but if I have a &quot;def&quot; <br></i>&gt;<i> (which is written over several lines), the RunString doesn&#39;t 
<br></i>&gt;<i> work any more... So how can I run the whole file, and not <br></i>&gt;<i> only line by line ?<br></i>&gt;<i> <br></i>&gt;<i> By the way, what does exactly the ImportModule function ? <br></i>&gt;<i> Maybe the .py file is already executed but I can&#39;t see it ? 
<br></i>&gt;<i> Is there a way to get the output and display it in the console ?<br></i>&gt;<i> <br></i>&gt;<i> Thanks for you answer <br></i>&gt;<i> <br></i>&gt;<i>         __ Sylvie LIVERNAIS ___________ <br></i>&gt;<i>         Applications Cartes à Puce 
<br></i>&gt;<i>         EID <br></i>&gt;<i>         * : +33 (0) 388 14 28 75 </i></pre><br><br><br>