The method you've described won't work. Rather if you try to embed the JS code through innerHTML it is not going to work.
Instead you can add the JS files through DOM based methods. An example would be the following:
Note that I am inserting the script element as the last child of the body element.
var script = document.createElement('script');
script.src = "your_script_file_name.js"; //Mention the correct path for your requirement
The script file that you dynamically insert can have certain function calls in it and it will be triggered as soon as the insertion is over.
Hope this helps.