Skip to main content

How to run Sublime Text Commands from the Console.

---
title: Run Sublime Text Commands from the Console
subtitle: How to run Sublime Text Commands from the Console
author: Sublime Text Unofficial Documentation
date: June 28, 2019
source: http://docs.sublimetext.info/en/latest/extensibility/commands.html#anatomy-of-a-command
notoc: true
---

Commands have a name separated by underscores (snake_case) like `hot_exit`, and
can take a dictionary of arguments whose keys must be strings and whose values
must be JSON types. Here are a few examples of commands run from the Python
console:

```python
view.run_command("goto_line", {"line": 10})
view.run_command('insert_snippet', {"contents": "<$SELECTION>"})
view.window().run_command("prompt_select_project")
```