Problems with calling function from one js file to another
<p>In the file data.js i have: </p>

<pre><code>(function () {

   data() 

   function runThisWhenDataIsFinished() {

        console.log("Works!"); 

   }


})();
</code></pre>

<p>In the file app.js i have</p>

<pre><code>function data() {

    console.log("Im in the data function");

    runThisWhenDataIsFinished();

}
</code></pre>

<p>When i call on data() i  get the message "Im in the data function", when i try to call on the runThisWhenDataIsFinished() method i get error: runThisWhenDataIsFinished() method is not defined.</p>

<p>So how can i access runThisWhenDataIsFinished method in data.js from app.js? </p>

<p>Best regards</p>
