title: How to call an IronPython 2 method from C#
body: <p>I can get an IronPython 2 class back to my C#.  What is the new IronPython 2 way of calling a member on that class?</p>
  
  <pre><code>object ironPythonClass = scope.GetVariable("Hamish");
  object[] args = new object[0];
  object pythonObject = engine.Operations.Call(ironPythonClass, args);
  
  var member = "Home";
  // old way IronPython 1
  // var methodResult = Ops.Invoke(this.pythonObject, SymbolTable.StringToId(member), args);
  </code></pre>
  
  <p>I thought all I'd have to do was</p>
  
  <pre><code>var methodResult = PythonOps.Invoke(codeContext, pythonObject, SymbolTable.StringToId(member), args);
  </code></pre>
  
  <p>but creating a dummy CodeContext doesn't seem to be right.  I feel as though I should be able to derive one from my</p>
  
  <pre><code>code.Execute();
  </code></pre>
  
  <p>that runs the Python file creating the class, plus the scope that arises out of that execution.</p>