title: Call Python function from JavaScript code
body: <p>I'd like to call a Python function from JavaScript code, because there isn't an alternative in JavaScript for doing what I want. Is this possible? Could you adjust the below snippet to work?</p>
  
  <p>JavaScript code:</p>
  
  <pre class="lang-js prettyprint-override"><code>var tag = document.getElementsByTagName("p")[0];
  text = tag.innerHTML;
  // Here I would like to call the Python interpreter with Python function
  arrOfStrings = openSomehowPythonInterpreter("~/pythoncode.py", "processParagraph(text)");
  </code></pre>
  
  <p><code>~/pythoncode.py</code> contains functions using advanced libraries that don't have an easy to write equivalent in JavaScript:</p>
  
  <pre><code>import nltk # is not in JavaScript
  def processParagraph(text):
    ...
    nltk calls
    ...
    return lst # returns a list of strings (will be converted to JavaScript array)
  </code></pre>