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
| Name | Type | Default | Description |
|---|---|---|---|
source_block_name | str | - | Name of source block |
sink_block_name | str | - | Name of sink block |
source_port_name | str | - | Port key on source block |
sink_port_name | str | - | 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: TrueNotes
- Use
get_block_sources()andget_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
| Name | Type | Default | Description |
|---|---|---|---|
source_port | PortModel | - | Source port to disconnect |
sink_port | PortModel | - | Sink port to disconnect |
Returns
Type: bool
True if successful.
Example
# Get the connection to disconnectconnections = 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" ))