title: Calling external js file
body: <p>I am trying to call an external js file from another
  js file. Here is my code:</p>
  
  <p>file1.js</p>
  
  <pre><code>function func1(id){
   var NewScript= document.createElement('script')
   NewScript.src="file2.js"
   document.body.appendChild(NewScript);
   func2(id);
  
  }
  </code></pre>
  
  <p>file2.js</p>
  
  <pre><code>function func2(id)
  {
      alert("im here " +id);
  
  }
  </code></pre>
  
  <p>But when I ran it it gives out the "func2 is not defined. " 
  Am i doing it right?</p>
  
  <p>Can somebody help me?</p>
  
  <p>Thanks</p>