How to use export & import in p5.js

That’s right! A JS module got 2 global contexts: A private 1 and a shared 1.

Explicitly appending to window or globalThis assures those properties can be accessed by both vanilla & module scripts which are sharing the same global context.