Skip to content

Reference Script Functions Obs

Kristopher Barrantes edited this page Nov 5, 2026 · 2 revisions

OBS script functions

Also on the Cuebot Docs site.

Functions for C# (Cb.Call) and Python (a cb method each, or cb.call). See Script functions for how to use them.

A Run Python code step in the action editor

obs.connections

Lists every OBS connection you set up in Cuebot.

Gives back: A list with one entry per connection: name, state (Disconnected, Connecting, Connected or Error) and scene (its current scene).

C#

var answer = await Cb.Call("obs.connections");

Python

answer = cb.obs_connections()

obs.getCurrentScene

Asks OBS which scene is live right now. Fails with an error when OBS is not connected.

Value In Python What to put in
connection connection Optional. The name of the OBS connection to use. Leave it out for your main OBS.

Gives back: The name of the live (program) scene, like "Gameplay".

C#

var answer = await Cb.Call("obs.getCurrentScene");

Python

answer = cb.obs_get_current_scene()

obs.request

Sends any obs-websocket command to OBS and gives back OBS's answer. Good for things Cuebot has no ready-made step for. Fails with an error when OBS is not connected.

Value In Python What to put in
requestType request_type The obs-websocket command name, like "GetVersion" or "SetCurrentProgramScene". Needed.
requestData request_data Optional. The settings for the command, like {"sceneName": "Gameplay"}. Leave it out when the command needs none.
connection connection Optional. The name of the OBS connection to use. Leave it out for your main OBS.

Gives back: OBS's answer data for that command (its responseData).

C#

var answer = await Cb.Call("obs.request", new { requestType = "SetCurrentProgramScene", requestData = new { sceneName = "Gameplay" } });

Python

answer = cb.obs_request(request_type="SetCurrentProgramScene", request_data={"sceneName": "Gameplay"})

obs.requestBatch

Sends several obs-websocket commands to OBS in one go. One failed command does not stop the rest, unless you ask it to. Fails with an error when OBS is not connected.

Value In Python What to put in
requests requests A list of commands. Each one has a requestType and, if needed, requestData, like {"requestType": "GetVersion"}. Needed.
haltOnFailure halt_on_failure Optional. true stops at the first command that fails. Default false.
connection connection Optional. The name of the OBS connection to use. Leave it out for your main OBS.

Gives back: A list with one result per command: its requestType, requestStatus (did it work) and responseData.

C#

var answer = await Cb.Call("obs.requestBatch", new { requests = new object?[] { new { requestType = "GetVersion" }, new { requestType = "SetCurrentProgramScene", requestData = new { sceneName = "Gameplay" } } } });

Python

answer = cb.obs_request_batch(requests=[{"requestType": "GetVersion"}, {"requestType": "SetCurrentProgramScene", "requestData": {"sceneName": "Gameplay"}}])

obs.setScene

Switches OBS to another scene. Fails with an error when OBS is not connected.

Value In Python What to put in
sceneName scene_name The scene name exactly as OBS shows it, like "Gameplay".
connection connection Optional. The name of the OBS connection to use. Leave it out for your main OBS.

Gives back: Nothing.

C#

var answer = await Cb.Call("obs.setScene", new { sceneName = "Gameplay" });

Python

answer = cb.obs_set_scene(scene_name="Gameplay")

Clone this wiki locally