Using a multi file script with the micropython javascript port

Hi,

I am looking at how to run a micropython script in a browser using the JS port. I have been able to send a URL to the script to be able to load my own program, but as far as I can tell that just reads the script in and runs it. It looks like all of the examples and demos also use a single file approach.

Is there a way to run scripts in a way that they can see other ‘local’ scripts?

That’s not exactly true.
Scripts can import modules and read input files (images, fonts) from the web (https). Currently the filesystem only reads from the web but this can probably be changed to localstorage with some work.

I had the same thoughts about importing modules and so tried freezing mine into the build of micropython. I have tried this on both the Unix and js port. On the Unix port I got the expected behaviour, however the behaviour on the jd port was often inconsistent sometimes failing to find modules and even then mint functions and class in those files were not found, have you come across this before?

No I haven’t. Maybe @embeddedt would have some insight.
I only used the js port in the context of our online simulator, where behavior seems consistent.