One of the best patterns to use here is to use addEventListener to listen for a custom event such as "MyScriptLoaded". Then, modify your included script to fire this event as its last action. This will ensure that you take action only after the new script has fully loaded.