title: Pass parameter with Python Flask in external Javascript
body: <p>I use Python Flask for my website and I pass several parameters to Javascript. This is my code:</p>
  
  <pre><code>from flask import Flask
  from flask import render_template
  
  app = Flask(__name__)
  
  
  @app.route("/")
  def index():
  
      return render_template("index.html", param1="Hello")
  
  
  &lt;html&gt;
     &lt;head&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;p&gt;Hello World&lt;/p&gt;
     &lt;/body&gt;
     &lt;script&gt;console.log({{param1}})&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>With this way, it works without a problem. The example is a simplified of my own. But, if I want to have the script on an external file and call it like this:</p>
  
  <pre><code>&lt;html&gt;
     &lt;head&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;p&gt;Hello World&lt;/p&gt;
     &lt;/body&gt;
     &lt;script src="/static/js/myjs.js"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the <code>myjs.js</code> file is the <code>console.log({{param1}})</code>, then it doesn't work. So, is there any way to pass parameters in external Javascript files with Python Flask?</p>