Description
Currently, calling pyscript.reload
with a global_ctx=
set to a newly created file results in an error indicating the global context cannot be found, which makes sense because a full reload hasn't happened yet so that global context has never been loaded, and, therefore, can't be reloaded.
For deleted files, pyscript.reload works just fine. The global_ctx is unloaded and, since the file no longer exists, is not reloaded.
It would be great if reload could look for the new file and cause it to load. Optionally, pyscript.load could be used instead to establish a difference between a new file and a reload. Though, if this happens, I suggest that reload does not work on deleted files and a pyscript.unload gets added.
This is a nice stepping stone to having full autoREload support in pyscript since this functionality will be needed for that.