PythonScript Xojo Plugin

PythonScript.GetModule Method

Gets a python module, looking for it at Pythons default path and custom paths.

shared GetModule(
   name as String) as PythonModule

Parameters

name
Name of the module to get.

Returns

PythonModule
The module or nil if unable to load the module.

Remarks

A Python module is the file that contains the Python script.

#if TargetMacOS
    f = App.ExecutableFile.Parent.Parent.Parent.Parent.Child("PythonModules")
#elseif TargetWin32 or TargetLinux
    f = App.ExecutableFile.Parent.Child("PythonModules")
#endif

PythonScript.AddSearchPath(f)

package = PythonScript.GetModule("SomeModule")

See Also

PythonScript Class