---
title: "D3Net"
description: "Managing D3Net configuration and machines using the Python API"
url: https://developer.disguise.one/python-api/guides/d3net/
---

# D3Net Configuration Python Samples

This guide demonstrates how to use the Disguise Python API to configure D3Net, including managing machines, roles, and director/understudy modes. These operations are essential for setting up distributed playback, redundancy, and show control in a D3Net environment.

* * *

## D3Net Manager Operations

A **[`D3NetManager`](/python-api/docs/d3netmanager)** object represents the networked system of machines (servers) in a Disguise project. It allows you to query and configure the roles of each machine, manage director/understudy states, and access networked resources.

### Machines and Roles

-   **[`Machines`](/python-api/docs/machine)** are individual servers or nodes in the D3Net system. Each machine can have a specific role (director, actor, understudy, etc.).
-   The **director** is the primary controller of the show, while **understudies** are backup machines ready to take over if the director fails.
-   You can query the list of machines, their roles, and change the director or understudy assignments.

| Task | Python |
| :-- | :-- |
| **Get the D3NetManager object** | `d3net = d3NetManager`<br>Returns the main [`D3NetManager`](/python-api/docs/d3netmanager) instance. |
| **List all machines in the D3Net** | `machines = d3net.machines`<br>Returns a list of all [`Machine`](/python-api/docs/machine) objects in the network. |
| **Get the local machine** | `local = d3net.localMachine`<br>Returns the [`Machine`](/python-api/docs/machine) object representing the current machine. |
| **Get the current director machine** | `director = d3net.director`<br>Returns the [`Machine`](/python-api/docs/machine) object currently acting as director. |
| **Get all understudy machines** | `understudies = d3net.understudies`<br>Returns a list of [`Machine`](/python-api/docs/machine) objects assigned as understudies. |
| **Check if a machine is the director** | `is_director = d3net.director == machine` |
| **Check if a machine is an understudy** | `is_understudy = d3net.isUnderstudy(machine)` |
| **Get the role of a machine** | `role = machine.role`<br>`is_actor = machine.role == MachineRole.Actor`<br>Returns a [`MachineRole`](/python-api/docs/machinerole). |
| **Set the director machine** | `d3net.director = machine`<br>Assigns the given machine as the director. |
| **Set the list of understudies** | `d3net.understudies = [machine1, machine2]`<br>Assigns the given machines as understudies. |
| **Check if the director is valid** | `has_valid_director = d3net.hasValidDirector` |
| **Get the status of a machine** | `status = d3net.machineStatus(machine.nodeId)`<br>Returns a status code or object for the machine. |
| **Find a machine by hostname** | `machine = d3net.findMachineByHostname("myhost")` |

* * *

## Director and Understudy Modes

D3Net supports different director/understudy modes for redundancy and failover.

| Task | Python |
| :-- | :-- |
| **Enable director mode on this machine** | `d3net.directorMode = True` |
| **Enable understudy mode on this machine** | `d3net.understudy = True` |
| **Check if dedicated director mode is active** | `is_dedicated = d3net.dedicatedDirectorMode` |
| **Check if non-dedicated director mode is active** | `is_non_dedicated = d3net.nonDedicatedDirectorMode` |
| **Check if solo mode is active** | `is_solo = d3net.soloMode` |
| **Get the current actor machines** | `actors = d3net.actors`<br>Returns a list of actor machines. |

* * *

## D3Net Commands and Utilities

You can send commands to machines, check network status, and manage routing.

| Task | Python |
| :-- | :-- |
| **Dispatch a command to all machines** | `d3net.dispatchCommandAll(cmd, sessionOnly=False)`<br>Sends a [`RemoteCommand`](/python-api/docs/remotecommand) to all machines. |
| **Dispatch a command to a specific machine** | `d3net.dispatchCommandDirect("hostname", cmd, sessionOnly=False)` |
| **Send matrix routing to a machine** | `d3net.sendMatrixRouting(machine, feed)`<br>Sends a [`FeedScene`](/python-api/docs/feedscene) routing to the specified machine. |
| **Check if an understudy is available for a machine** | `available = d3net.understudyAvailableFor(machine)` |
| **Get understudy config status** | `status = d3net.getUnderstudyConfigStatus(understudy_machine)` |
