def load(self, name, code):
        """Prepare a Python code object given by the RiveScript interpreter.

        :param str name: The name of the Python object macro.
        :param []str code: The Python source code for the object macro.
        """
        # We need to make a dynamic Python method.
        source = "def RSOBJ(rs, args):\n"
        for line in code:
            source = source + "\t" + line + "\n"

        source += "self._objects[name] = RSOBJ\n"

        try:
            exec(source)
            # self._objects[name] = RSOBJ
        except Exception as e:
            print("Failed to load code from object", name)
            print("The error given was: ", e)
def load ( self , name , code ) : source = "def RSOBJ(rs, args):\n" for line in code : source = source + "\t" + line + "\n" source += "self._objects[name] = RSOBJ\n" try : exec ( source ) except Exception as e : print ( "Failed to load code from object" , name ) print ( "The error given was: " , e )
Prepare a Python code object given by the RiveScript interpreter.

        :param str name: The name of the Python object macro.
        :param []str code: The Python source code for the object macro.