Registers a Xojo module to expose to python.
xojoModule as Python3XojoModule
- The Xojo module to expose to Python.
- Address of module creation function. (See notes bellow and the example projects that come with the plugin)
You should normally call this in your App.Open even right before Python3Script.Init
Note difference from our other PythonScript plugin which is for Python 2.7.x:Example:
For Python 3.4.x then classes exposed from Xojo must be registered before the Init method is called while in 2.7.x we registered them after the Init.
Also since modules are created in different way then you now must include additional parameter which is address of a module creation function in your module
If not Python3Script.PythonIsFound() then
MsgBox "Correct Python installation was not found on this machine"
// We register the module to Python
Python3Script.RegisterXojoModule(xojoModule, AddressOf XojoFunctionsForPython.ModuleInit)
// Init the Python engine
Where the ModuleInit function will have code like this here:
Function ModuleInit() As Ptr
// You get this callback when the PythonModule is actually created for this first time.
// This is needed because Python 3.x is very differently wired and doing this internally was not possible.
// DO NOT RETURN ANYTHING HERE EXCEPT JUST WHAT THE MODULECREATEPROC FUNCTION RETURNS