Saving variables to global environment

Absolutely! When p5js is loaded, it checks for the existence of functions setup() or draw() in the global context.