6.1.2 Instantiating a Service Object

A Service object can be instantiated using the load API, with the required service provider details. Import scriptext module before using the method.


import scriptext
scriptext_handle = scriptext.load(<provider>, <interface>)


The first argument is a string that specifies the name of the service provider.

The second argument is a string, that specifies one of the supported interfaces of the <provider>.

Return Value

The load() method returns a service object for a successful call. This method raises ScriptextError when the service provider name or the interface name is null.


The following sample code illustrates how to instantiate messaging service object:

import scriptext

    messaging_handle = scriptext.load("Service.Messaging", "IMessaging")

except err:
    # Handle error while instantiating the service.

See About this document... for information on suggesting changes.