You can use anvil.js to call JavaScript from within client-side Python. That’s what this solution is using, I think:
p.s.
I’m not understanding how this limits anything. If you want to use that JavaScript on a form, use a Custom HTML form. (Any form can be changed to “Custom HTML” by selecting the ‘html’ dropdown under ‘properties’. If you want it to have the same html as the standard form, just copy the html from standard_page.html into the Custom HTML for that form.)