Skip to content

Connection Tools

Tools for managing connections (wires) between blocks.

get_connections

List all connections in the flowgraph.

Returns

Type: list[ConnectionModel]

List of connections with source/sink block names and port keys.

Example

connections = get_connections()
# Returns: [
# ConnectionModel(
# source_block="osmosdr_source_0", source_port="0",
# sink_block="low_pass_filter_0", sink_port="0"
# ),
# ...
# ]

connect_blocks

Connect two blocks by their ports.

Parameters

NameTypeDefaultDescription
source_block_namestr-Name of source block
sink_block_namestr-Name of sink block
source_port_namestr-Port key on source block
sink_port_namestr-Port key on sink block

Returns

Type: bool

True if successful.

Example

connect_blocks(
source_block_name="osmosdr_source_0",
sink_block_name="low_pass_filter_0",
source_port_name="0",
sink_port_name="0"
)
# Returns: True

Notes

  • Use get_block_sources() and get_block_sinks() to discover available ports
  • Most blocks use port "0" for their primary input/output
  • Port types must be compatible (e.g., both complex, both float)

disconnect_blocks

Disconnect two blocks.

Parameters

NameTypeDefaultDescription
source_portPortModel-Source port to disconnect
sink_portPortModel-Sink port to disconnect

Returns

Type: bool

True if successful.

Example

# Get the connection to disconnect
connections = get_connections()
conn = connections[0]
disconnect_blocks(
source_port=PortModel(
parent=conn.source_block,
key=conn.source_port,
name="out",
dtype="complex",
direction="source"
),
sink_port=PortModel(
parent=conn.sink_block,
key=conn.sink_port,
name="in",
dtype="complex",
direction="sink"
)
)