PythonScript Xojo Plugin |

# PythonXojoClass.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. For constructors then Python will want it as __init__
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 PythonParameters = new PythonParameters(pyArgs)
if params.Count = 4 then // since classes send 1 extra param
MsgBox "Constructed class with 3 parameters"
else
PythonScript.SetError(PythonErrorTypes.TypeError,"Constructor of MyXojoClass must have exactly 3 parameters")
return nil
end if
return PythonResult(new PythonResult()).GetPtr()

#### See Also

PythonXojoClass Class