title: Postman - calling function in external JS file - 'x is not defined'
body: <p>Other posts have dealt with this question, but I continue to be unable to apply this myself.</p>
  
  <p>I have a Postman pre-script test.</p>
  
  <p>I am trying to call an encryption function defined in 
  <a href="http://some-server:port/lib/forge/forge.min.js" rel="nofollow noreferrer">http://some-server:port/lib/forge/forge.min.js</a></p>
  
  <p>The code calls the code like this:</p>
  
  <pre><code>let pubKey = forge.pki.publicKeyFromPem(atob(publicKey));
  ...
  let .... = forge.util.encodeUtf8(data));
  let ... = forge.util.encode64(text);
  ...
  </code></pre>
  
  <p>I tried the <code>eval</code> trick, putting the whole code into a variable.  </p>
  
  <pre><code>var code = pm.collectionVariables.get('forge.min.js');
  eval(code);
  </code></pre>
  
  <p>The resulting error was:  </p>
  
  <blockquote>
    <p>ReferenceError: forge is not defined</p>
  </blockquote>
  
  <p>The code variable has the whole block of minified Javascript.</p>