How can I get the callback to not run until the script is actually appended to the document?
function addScript(filepath, callback){ if (filepath) {
Easiest way will be define some visible callback() function which will run in your dynamicly included script, at the end.
callback()