Package Contents



class viam.module.Module(address: str, *, log_level: int = logging.INFO)[source]
parent: viam.robot.client.RobotClient | None
server: viam.rpc.server.Server
classmethod from_args() typing_extensions.Self[source]

Create a new Module with the args provided in the command line. The first argument after the command must be the socket path. If the second argument after the command is “–log-level=debug”, the Module’s logger will be DEBUG level. Otherwise, it will be INFO level. See LogLevel documentation in the RDK for more information on how to start modules with a “log-level” commandline argument.


Exception – If there is no socket path provided in the command line argument


a new Module instance

Return type:


async start()[source]

Start the module service and gRPC server

async stop()[source]

Stop the module service and gRPC server

set_ready(ready: bool)[source]

Set the module’s ready state. The module automatically sets to READY on load. Setting to False can be useful in instances where the module is not instantly ready (e.g. waiting on hardware)


ready (bool) – Whether the module is ready

async add_resource(request: viam.proto.module.AddResourceRequest)[source]
async reconfigure_resource(request: viam.proto.module.ReconfigureResourceRequest)[source]
async remove_resource(request: viam.proto.module.RemoveResourceRequest)[source]
async ready(request: viam.proto.module.ReadyRequest) viam.proto.module.ReadyResponse[source]
add_model_from_registry(subtype: viam.resource.types.Subtype, model: viam.resource.types.Model)[source]

Add a pre-registered model to this Module

async validate_config(request: viam.proto.module.ValidateConfigRequest) viam.proto.module.ValidateConfigResponse[source]