title: How to make the browser load a module script after other scripts have been loaded?
body: <p>I ran into an issue today where my script with type="module" is executed before my main.js script which holds some important functions. Or it has not yet finished loading the first script before it loads the second.</p>
  
  <p>Then my module is complaining that a function is not defined which was defined in my main.js. This doesn't happen every time though. Other times my main.js gets loaded first and everything works the way it should.</p>
  
  <pre><code>&lt;script src="http://localhost/newblog/js/main.js"&gt;&lt;/script&gt;
  &lt;script type="module" src="http://localhost/newblog/js/blog.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Is there a way to make the second script wait until my first script has finished loading and only then load the second script?</p>