viam.module.module ================== .. py:module:: viam.module.module Classes ------- .. autoapisummary:: viam.module.module.Module Module Contents --------------- .. py:class:: Module(address: str, *, log_level: int = logging.INFO, tcp_mode: bool = False) .. py:attribute:: parent :type: Optional[viam.robot.client.RobotClient] :value: None .. py:attribute:: server :type: viam.rpc.server.Server .. py:attribute:: logger :type: logging.Logger .. py:method:: from_args() -> typing_extensions.Self :classmethod: 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. :raises Exception: If there is no socket path provided in the command line argument :returns: a new Module instance :rtype: Module .. py:method:: run_with_models(*models: viam.resource.base.ResourceBase) :classmethod: :async: Module entrypoint that takes a list of ResourceBase implementations. In most cases you'll want to use run_from_registry instead (see below). .. py:method:: run_from_registry() :classmethod: :async: Module entrypoint that automatically includes all the resources you've created in your program. Example: if __name__ == '__main__': asyncio.run(Module.run_from_registry()) Full example at examples/easy_resource/main.py. .. py:attribute:: module_name .. py:method:: start() :async: Start the module service and gRPC server .. py:method:: stop() :async: Stop the module service and gRPC server .. py:method:: set_ready(ready: bool) 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 (for example waiting on hardware) :param ready: Whether the module is ready :type ready: bool .. py:method:: add_resource(request: viam.proto.module.AddResourceRequest, *, deadline: Optional[grpclib.metadata.Deadline] = None) :async: .. py:method:: reconfigure_resource(request: viam.proto.module.ReconfigureResourceRequest) :async: .. py:method:: remove_resource(request: viam.proto.module.RemoveResourceRequest) :async: .. py:method:: ready(request: viam.proto.module.ReadyRequest) -> viam.proto.module.ReadyResponse :async: .. py:method:: add_model_from_registry(api: viam.resource.types.API, model: viam.resource.types.Model) Add a pre-registered model to this Module .. py:method:: validate_config(request: viam.proto.module.ValidateConfigRequest) -> viam.proto.module.ValidateConfigResponse :async: