title: How do I call Java Methods from Jython that is executed by the Java class?
body: <p>I am a novice programmer in (Java/C++/C#) and I also know Python. I am trying to create a GameEngine in Java that can call Jython scripts, that have access to methods in the Java engine.</p>
  
  <p>I am clueless as to how to approach this. I have already done weeks of research and nothing has answered my question ; that is:</p>
  
  <p>How can I call methods in my Parent class, from my JythonScript, which is executed by my Parent class?</p>
  
  <p>-----------------------------------UPDATE---------------------------------------------------</p>
  
  <p>Okay, The answer here helped me understand some things, but it didn't solve my problem.
  What I was wondering if something such as this would  work:</p>
  
  <pre><code>class MyJavaClass
  {
      Public MyJavaClass()
      {
          PythonInterpreter interp = new PythonInterpreter;
          interp.execfile("MyJythonScript.py");
          interp.exec("InGameCommand");
      }
  
      public void SpawnPlayer()
      {}
  
      public void KillPlayer()
      {}
  
  }
  </code></pre>
  
  <p>MyJythonScript.py</p>
  
  <pre><code>Def InGameCommand():
      SpawnPlayer()
      KillPlayer()
  </code></pre>
  
  <p>Is this even possible? There a way to do this?</p>
  
  <p>-----------------------------------UPDATE---------------------------------------------------</p>
  
  <p>Location to Jython:  "C:\jython2.7a2\jython.jar"
  Location to my work: "C:\Documents and Settings\PC\Desktop\Jython*.java"
  Location to my local JtyhonJar: "C:\Documents and Settings\PC\Desktop\Jython\jython.jar"</p>
  
  <p>my compiler I wrote:
  "@echo off"
  "javac -classpath C:\jython2.7a2\jython.jar *.java"
  "echo done"
  "pause >nul"</p>
  
  <p>now it doesn't even compile... (I've changed little things in my code to see if it changed and it hasn't!)</p>