@Sunil Patel thank you but this suggestion doesn't work either.
No error on loading the remote file, but the functions it contains are not made available and generate errors when called.
It's surprising that loading a remote javascript file directly in a template seems to be such a big challenge.
add defer into script
yes, I have added defer as described in your suggestion, it doesn't seem to work.