Skip to main content

Custom Modules

By default, Python modules are cached. If you intend to make changes to an imported module, it needs to be watched and reloaded.

Create a module using the file system APIs or write the file using Python, examples here.

Then call watchModules() to automatically reload the module before running code. For more info, see the API reference docs.

The following example shows this in action. To try it out:

  • Click Write file which will call writeFile() and create utils.py with the code in the editor window
  • Run main.py by clicking Run
  • Make a change to utils.py and click Write file again, note that when you Run again, the imported module is unchanged
  • Click Watch which will call watchModules(['utils']) and then observe the module has been reloaded when you Run again
  • You will still need to click Write file again if you make any further changes
  • To no longer automatically reload the module, you can click Unwatch which will call unwatchModules(['utils'])
Loading...

You can find the source code for this example here.