first of all, its getting quite horrible to write javascript code inside ‘’’ jscode ‘’’ in python (so i made a manual solution where i am loading js code from a js file and injecting that)
As far as I can see, the options are
code = """ manual code string """
and
code = open("some_jscode.js").read()
Are you proposing some new maintained API just to spell the second version some different way? I don’t think a dedicated PI is warranted for replacing what can already be done with built-in Python functions trivially.
If you are asking about being able to use require, import, etc. to load modules, then I’ll note that that is simply out of scope for CustomJS. The motivation behind CustomJS etc (and one of their requirements) is that they work without a compilation step, or needing to have node installed. That is to keep things as simple as possible for the majority of basic use-cases. Once compilation/packing is involved, things are in the realm of custom extensions.
It’s possible there is some way to allow compiled code to be used for CustomJS and friends but any solution would need to be explicitly enabled and off by default so that the common case still requires no heavy dependencies be installed. But that would be new developenmt. so aGitHub development discussion would be appropriate