title: Why can't I use functions from javascript-files that are imported by require()?
body: <p>I started using <a href="http://electron.atom.io/" rel="noreferrer">electron</a>.</p>
  
  <p>In the <a href="https://github.com/electron/electron-quick-start/blob/master/index.html" rel="noreferrer">index.html of electron-quick-start</a> a JavaScript file is included using <code>require()</code>.</p>
  
  <pre><code>&lt;script&gt;
    // You can also require other files to run in this process
    require('./renderer.js')
  &lt;/script&gt;
  </code></pre>
  
  <p>Now I defined a simple function named <code>flash()</code> in <code>renderer.js</code>, as well as a log output:</p>
  
  <pre><code>function flash(text) {
    alert("Text: " + text + "!");
  }
  
  console.log("Renderer loaded.");
  </code></pre>
  
  <p>After starting the electron app, I the the log-output in the console of the dev-tools. but calling <code>flash()</code> does not work.</p>
  
  <p>When including the script using</p>
  
  <pre><code>&lt;script src='./renderer.js'&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I can call the function.</p>
  
  <ul>
  <li><strong>Where does the <code>require()</code> function come from?</strong></li>
  <li><strong>Why can't I use the function when including the file using <code>require</code>?</strong></li>
  <li><strong>How can I use function defined in files that are required?</strong></li>
  <li><strong>When should I use <code>require()</code> and when should I use <code>src=""</code>?</strong></li>
  </ul>