Thread should be moved to Products. Remember, the "Community" space is for website feedback (and yes, that's confusing).
Although you should post your example URL, I assume you have a classic asynchronous script loading problem.
Unless you make MktoForms2.loadForm depend on the external script forms2.min.js being loaded first, this won't work. Script-injecting other remote scripts (that's what's happening when you insert HTML with a <script> tag in it after the page's DOM has initially loaded) always means the remote script is loaded asynchronously. So when MktoForms2.loadForm attempts to run, it fails because MktoForms2 doesn't exist yet.
I would instead have the <script> that loads forms2.min.js enabled all the time (in the <head> of your page). Then you just run MktoForms2.loadForm when you need it. There's no need for a $() wrapper here.