Question about when a script is executed after appending it
<p>In my code, I have javascript that dynamically adds another script to the page:</p>

<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
</code></pre>

<p>in this 'other script', I have a function called reloader().</p>

<p>The problem I'm having is that right after I dynamically add the script, I try to call the function reloader(), but I'm getting a reloader is not defined error.
Here's is like what I am doing:</p>

<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
reloader();
</code></pre>

<p>Can someone explain to me why this doesn't work and how should I fix this so that reloader() can be called after appending the script in a single dynamic call (if possible at all)?</p>
