title: Running Kotlin Scripts (.kts) with bindings from IntelliJ - unresolved reference: bindings
body: <p>I am trying to run <strong>.kts</strong> scripts (using Script Engine) from a Kotlin program.</p>
  <p>The Kotlin scripts reside in the resource folder of the project and normally they have support for auto-completion, IDE checks, auto-complete, etc.</p>
  <p>The problem appeared when I wanted to pass external variables to the script using bindings. I am doing something like:</p>
  <pre><code>scriptEngine.eval(scriptContent, scriptEngine.createBindings().apply { putAll(bindings) })
  </code></pre>
  <p>The <code>bindings</code> is a <code>Map&lt;String, Any&gt;</code> that contains the variables I want to access in my script: <code>bindings[&quot;variable&quot;]</code>.</p>
  <p>Problem is that IntellIJ doesn't recognize <code>bindings</code> in the .kts script, so it shows a &quot;unresolved reference: bindings&quot;. If I run the script from command line everything is fine, but inside IntelliJ i have this problem.</p>
  <p>Is there a way to overcome the issue ? Has any experienced the same problem?</p>