title: Where is the python in this script being called/pulled from?
body: <p>I found a project in Unity 5 where python can be run in Unity, and i want to add libraries to it. The trouble is, i can't seem to find where the python libraries from this script. To me, it looks like they're being generated out of thin air. Can i have a pointer as to where this might be coming from? I tried adding it to python path, and its not seeming to work.</p>
  
  <pre><code>using System;
  using System.IO;
  using System.Linq;
  using UnityEngine;
  using System.Text;
  using System.Collections;
  using IronPython.Hosting;
  using IronPython.Modules;
  using System.Collections.Generic;
  using Microsoft.Scripting.Hosting;
  
  
  /// &lt;summary&gt;
  /// Interpreter for IronPython.
  /// &lt;/summary&gt;
  public class Interpreter
  {
      /// &lt;summary&gt;
      /// The scope.
      /// &lt;/summary&gt;
      private ScriptScope  Scope;
  
      /// &lt;summary&gt;
      /// The engine.
      /// &lt;/summary&gt;
      private ScriptEngine Engine;
  
      /// &lt;summary&gt;
      /// The source.
      /// &lt;/summary&gt;
      private ScriptSource Source;
  
      /// &lt;summary&gt;
      /// The compiled.
      /// &lt;/summary&gt;
      private CompiledCode Compiled;
  
      /// &lt;summary&gt;
      /// The operation.
      /// &lt;/summary&gt;
      private ObjectOperations Operation;
  
      /// &lt;summary&gt;
      /// The python class.
      /// &lt;/summary&gt;
      private object PythonClass;
  
      /// &lt;summary&gt;
      /// Initializes a new instance of the &lt;see cref="Interpreter"/&gt; class.
      /// &lt;/summary&gt;
      public Interpreter()
      {
          Engine = Python.CreateEngine();
          Scope  = Engine.CreateScope();
          SetLibrary();
      }
  
      /// &lt;summary&gt;
      /// Initializes a new instance of the &lt;see cref="Interpreter"/&gt; class.
      /// &lt;/summary&gt;
      /// &lt;param name="source"&gt;Source.&lt;/param&gt;
      public Interpreter(string src) : this()
      {
          Compile(src);
      }
  
      /// &lt;summary&gt;
      /// Compile the specified src.
      /// &lt;/summary&gt;
      /// &lt;param name="src"&gt;Source.&lt;/param&gt;
      public string Compile(string src, Microsoft.Scripting.SourceCodeKind CodeKind =
                                        Microsoft.Scripting.SourceCodeKind.SingleStatement)
      {
          if(src == string.Empty)
              return string.Empty;
  
          LoadRuntime();
  
  
          Source = CodeKind == Microsoft.Scripting.SourceCodeKind.SingleStatement ?
                               Engine.CreateScriptSourceFromString(src, CodeKind) :
                               Engine.CreateScriptSourceFromFile(src);
  
          ErrorHandle errors = new ErrorHandle();
  
          MemoryStream stream = new MemoryStream();
          //Set IO Ouput of execution
          Engine.Runtime.IO.SetOutput(stream, new StreamWriter(stream));
  
          Compiled  = Source.Compile(errors);
          Operation = Engine.CreateOperations();
  
          try {
              Compiled.Execute(Scope);
              return FormatOutput(ReadFromStream(stream));
  
          } catch(Exception ex) {
              return Engine.GetService&lt;ExceptionOperations&gt;().FormatException(ex);
          }
      }
  
      /// &lt;summary&gt;
      /// Formats the output of execution
      /// &lt;/summary&gt;
      /// &lt;returns&gt;The output.&lt;/returns&gt;
      /// &lt;param name="output"&gt;Output.&lt;/param&gt;
      private string FormatOutput(string output)
      {
          return string.IsNullOrEmpty(output) ? string.Empty 
          :      string.Join("\n", output.Remove(output.Length-1)
                                         .Split('\n')
                                         .Reverse().ToArray());
      }
  
      /// &lt;summary&gt;
      /// Reads MemoryStream.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;The from stream.&lt;/returns&gt;
      /// &lt;param name="ms"&gt;Ms.&lt;/param&gt;
      private string ReadFromStream(MemoryStream ms) {
  
          int length = (int)ms.Length;
          Byte[] bytes = new Byte[ms.Length];
          ms.Seek(0, SeekOrigin.Begin);
          ms.Read(bytes, 0, length);
  
          return Encoding.GetEncoding("utf-8").GetString(bytes, 0, length);
      }
  
      /// &lt;summary&gt;
      /// Set sys paths
      /// &lt;/summary&gt;
      private void SetLibrary()
      {
          if(PythonBase.SysPath.Count &gt; 0) {
  
              ICollection&lt;string&gt; SysPath = Engine.GetSearchPaths();
  
              foreach(string path in PythonBase.SysPath)
                  SysPath.Add(path);
  
              Engine.SetSearchPaths(SysPath);
          }
      }
  
      /// &lt;summary&gt;
      /// Load runtime Assemblies of Unity3D
      /// &lt;/summary&gt;
      private void LoadRuntime()
      {
          Engine.Runtime.LoadAssembly(typeof(GameObject).Assembly);
      }
  
      public void AddRuntime&lt;T&gt;()
      {
          Engine.Runtime.LoadAssembly(typeof(T).Assembly);
      }
  
      public void AddRuntime(Type type)
      {
          Engine.Runtime.LoadAssembly(type.Assembly);
      }
  
      /// &lt;summary&gt;
      /// Gets the variable or class
      /// &lt;/summary&gt;
      /// &lt;returns&gt;The variable.&lt;/returns&gt;
      /// &lt;param name="name"&gt;Name.&lt;/param&gt;
      public object GetVariable(string name)
      {
          return Operation.Invoke(Scope.GetVariable(name));
      }
  
      /// &lt;summary&gt;
      /// Calls the method.
      /// &lt;/summary&gt;
      /// &lt;param name="name"&gt;Name.&lt;/param&gt;
      public void InvokeMethod(object nameClass, string Method, params object[] parameters)
      {
          object output = new object();
          if(Operation.TryGetMember(nameClass, Method, out output)) {
              object Func = Operation.GetMember(nameClass, Method);
              Operation.Invoke(Func, parameters);
          }
      }
  }
  </code></pre>