You'll need to put C:/TESTPROJS/Project3/Project1/ into Sys.path using PythonEngine.AddToPath. That will then allow the import machinery to search in the right place to find the file to import.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kaveripakam, Sathish Sent: Wednesday, November 28, 2007 7:18 AM To: [email protected] Subject: [IronPython] Interfacing multiple Iron python scripts Hi All, I am trying to integrate the C# code with multiple Iron Python scripts. The idea is: C# code: main.cs calls the main function in mainpyfile.py. The mainpyfile.py has a call a function SetUP which is present in an another ironpython script called Patch1. The working behavior is: C# code calls the mainpyfile.py as expected, but when mainpyfile.py tries to call the function in Patch1.py, I encountered a run time error saying Patch1 is not found. I have used "import Patch1" in mainpyfile.py file for the visibility of SetUp function in mainpyfile Please do let me know, if there are any concerns in interfacing multiple Iron Python files with C# code using .NET frame work? I am using Iron python 1.1 version using Visual Studio 2K. Please find the description of the files: main.cs: static void Main(string[] rawArgs) { PythonEngine engine = new PythonEngine(); engine.Sys.argv = List.Make("C:/TESTPROJS/Project3/Project1/"); EngineModule engineModule = engine.CreateModule( "__main__", new Dictionary<string, object>(), true); engine.DefaultModule = engineModule; string path = Path.Combine("C:/TESTPROJS/Project3/Project1/","mainpyfile.py" ); engine.ExecuteFile(path); } mainpyfile.py: import Patch1 def main(): print 'IN MAIN FUNCTION' Patch1.SetUp() if __name__ == "__main__": main() Patch1.py: def SetUp: print 'PATCH-1' Regards ________________________________ Legal Notice: The information in this electronic transmission may contain confidential or legally privileged information and is intended solely for the individual(s) named above. If you are not an intended recipient or an authorized agent, you are hereby notified that reading, distributing, or otherwise disseminating, copying or taking any action based on the contents of this transmission is strictly prohibited. Any unauthorized interception of this transmission is illegal under law. If you have received this transmission in error, please notify the sender by telephone [at the number indicated above/on +41 58 928 0101] as soon as possible and then destroy all copies of this transmission. ________________________________
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
