ScriptScope
Prior to any code execution, ScriptScopes can be populated with variables by hosts using methods defined in this type and these variables are then available to any code that’s executed in its context. ScriptScope also acts as a unit of isolation - it maintains state, isolates side effects from code and can be reused as a context to execute another code snippet.
The Hosting API spec describes this type in detail. The following list is a short summary of some of the key points described by the spec
o ScriptScope scope = pythonEngine.CreateScope();
o ScriptScope scope = runtime.CreateScope();
o ScriptScope scope = runtime.ExecuteFile(@"C:\Foo.py");
o public object Execute(string code)
o public bool ContainsVariable(string name)
o public object GetVariable(string name)
o public void SetVariable(string name, object value)
o public bool RemoveVariable(string name)
o public void ClearVariables()
In addition to the above items, the spec also contains details about each of the method defined in this type and their arguments.