There is a difference.
Here are the ways to run a javascript file other than putting it in script tags. Note that "import" isn't available in older javascript engines.
https://stackoverflow.com/questions/950 ... cript-file
As long as you load from a file they will mostly behave the same, although if the load is done via the execute javascript action the file will load asynchronously so it won't be able to run right away.
If you put code directly in the action that you want to run later, you'll run into scope issues. Basically any var or function will be local instead of global as when run from a file. You can get around that by putting them inside a global variable. For example instead of
var foo=33;
you could use
window.foo=33;
Then you can use foo any time later.
Of course in nwjs exports there is no global window object so you'll have to get the global object some other way. Isn't javascript fun?