modal run

Run a Modal function or local entrypoint.

FUNC_REF should be of the format {file or module}::{function name}. Alternatively, you can refer to the function via the app:

{file or module}::{app variable name}.{function name}

Examples:

To run the hello_world function (or local entrypoint) in my_app.py:

modal run my_app.py::hello_world

If your module only has a single app called app and your app has a single local entrypoint (or single function), you can omit the app and function parts:

modal run my_app.py

Instead of pointing to a file, you can also use the Python module path:

modal run my_project.my_app

Usage:

modal run [OPTIONS] FUNC_REF

Options:

  • -q, --quiet: Don’t show Modal progress indicators.
  • -d, --detach: Don’t stop the app if the local process dies or disconnects.
  • -i, --interactive: Run the app in interactive mode.
  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.