Is your modular page implementing assets.js() or inheriting it from base.html.twig?
You need to have this somewhere in your template in order for js to be added to the page:
Calling parent() will not instantiate the parent, only return its object. In the context of modular-pages, their children - or modules - are not capable of adding assets upwards because they do not extend the base(.html.twig). Since your JS will be rendered page-wide for the modular, add it in modular.html.twig, as this template extends base.
ah I understand now. I was thinking it was down to the inheritance levels in twig but this makes sense. I’ve got it working now by updating the modular.twig.html with my JS. Thanks a lot
Adding JS assets to the modular template modular.html.twig is not a clean solution as other modular pages still use the modular template. There should be a standard way of injecting one-off CSS and JS assets from modules in my opinion.