edit on Repl.it

Modules

When starting a new repl, we like to start you with a "main" file so you can get to coding quickly. However, if you want to split your project into multiple files you can do so by adding a new file from the files sidebar.

You can then import the module by referencing the name. Every language will have different syntax for doing this so please consult the respective language documentation.

Here is an example in Python:

Uploading and assets

You can upload files by either dragging and dropping them into the files sidebar or by clicking the "three dot menu" and selecting upload file (you can also upload a whole folder!):

We support uploading any file type including images, video, and audio files, which will be displayed correctly in the browser. These files can also be programmatically generated.

For example, you can upload an image, alter it programmatically, and save the result to a new image. Like this (which you can try out here):

You can edit a file's name or delete it if you wish by clicking on the icon beside it. If you're renaming your file, make sure you have the right extension for it.

Two things to note about files:

  1. They can be of any type/extension and you can use them in your code however you'd like.
  2. Files will be placed in the current working directory, generally you'd access it through the relative path './filename.ext'.

Here's a few examples on files in different languages:

File Changes

Programmatic file changes will get synced down to the repl automatically. In case of images we will display and update them for you on each change. This makes it really nice for plotting and data science work. Which we cover in Python plots.