ReferenceError on calling an external JS snippet

Hello velo folks,
I am trying to run a script for a external booking engine using a button on my site. The booking page is like a lightbox and covers the whole page. The external script was referenced in the custom code area (Body - End) and can also be triggered succesfully via console. But when I want to use an onClick event of a button the object is not found. (ReferenceError)
Do you have a tip for me what else I can try?

Not possible to call it from Velo code. Please consider using “Custom Code” from the Wix dashboard > settings > custom code. Wix window module might helps.