I am dynamically adding a script of a github gist. If I added it to the html before the page loads, the script will execute. But If I try to add it to the page after it load
So, as an alternative, I actually just stumbled upon a library which seems like it would handle this for you. Check out Injector.js, and it should work for you.