Original Post
I'm currently trying to embed IronPython within a C# environment. I'm most likely going to use it to replace Lua that I currently use(with LuaInterface). The background: I currently use Lua and after creating the LuaVM, I load an autoexec.lua which loads various other files through an include into the VM. My application starts doing it's thing and on certain events, it'll call a function that's written in Lua through the VM. This works fine. I'm trying to accomplish the same thing with IronPython at the moment. I want to create a new ScriptEngine, expose a few functions to it(Such as an 'include' or similar command), load my autoexec.py and have that include various other files. I'm up to a point where I can load an autoexec.py(or just inject other code), but I'm not entirely sure how to proceed from here. First of all, how do I call a function in the SE instance? This is what I go up till now: Ideas? Toolmaker
engine = Python.CreateEngine();
var code = "def add(a, b): return a + b";
var src = engine.CreateScriptSourceFromString(code, Microsoft.Scripting.SourceCodeKind.InteractiveCode);
var scope = engine.CreateScope();
// How do I call add?