/// <summary> /// Constructor to initialize the python subsystem /// </summary> /// <param name="scriptedSubXmlNode"></param> /// <param name="dependencies"></param> /// <param name="asset"></param> public ScriptedSubsystem(XmlNode scriptedSubXmlNode, Dependency dependencies, Asset asset) { Asset = asset; GetSubNameFromXmlNode(scriptedSubXmlNode); string pythonFilePath = "", className = ""; XmlParser.ParseScriptedSrc(scriptedSubXmlNode, ref pythonFilePath, ref className); var engine = Python.CreateEngine(); var scope = engine.CreateScope(); var ops = engine.Operations; engine.ExecuteFile(pythonFilePath, scope); var pythonType = scope.GetVariable(className); _pythonInstance = ops.CreateInstance(pythonType, scriptedSubXmlNode, asset); Dictionary <string, Delegate> newDependencies = _pythonInstance.GetDependencyDictionary(); dependencies.Append(newDependencies); DependentSubsystems = new List <Subsystem>(); SubsystemDependencyFunctions = new Dictionary <string, Delegate>(); Delegate depCollector = _pythonInstance.GetDependencyCollector(); SubsystemDependencyFunctions.Add("DepCollector", depCollector); }