Python3Script Xojo Plugin |

# Python3XojoClass.RegisterFunction Method (console safe)

Registers a Xojo function to expose to Python via this class

RegisterFunction(
name as String,
fuction as Ptr)

#### Parameters

name
  Name of the function as Python should see it. This name does not have to be same as the name of the Xojo function.
fuction
  Address of the Xojo function that should by called from Python.
  Note
  The parameters and return value must always be as follows:
  SomeFunctionName(pySelf as Ptr, pyArgs as Ptr) as Ptr

#### Remarks

Example function in Xojo with correct function parameters and result value:

Dim params as Python3Parameters = new Python3Parameters(pyArgs)
if params.Count = 4 then // since classes send 1 extra param
MsgBox "Constructed class with 3 parameters"
else
Python3Script.SetError(Python3ErrorTypes.TypeError,"Constructor of MyXojoClass must have exactly 3 parameters")
return nil
end if
return Python3Result(new Python3Result()).GetPtr()

#### See Also

Python3XojoClass Class