Python3Script Xojo Plugin |

# Python3Script.PythonIsFound Method

Checks if valid Python installation is found. Optionally a constant can also be passed in to hint which version of Python is preferred if Python has not already been loaded.

shared PythonIsFound(
preferredVersion as Python3Script.PreferredVersionValues) as Boolean

#### Parameters

preferredVersion
  Optional parameter: With this parameter you can pass in Python3Script.PreferredVersionValues enum value to hint which Python version you prefer if more than one is found.

#### Returns

Boolean
  True if valid Python 3.4.x, 3.5.x, 3.6.x, 3.7.x or 3.8.x installation was found, else false.

#### Remarks

Version 3.4.x, 3.5.x, 3.6.x, 3.7.x, 3.8.x, 3.9.x, 3.10.x, 3.11.x or 3.12.x is needed for this plugin. If you want for 2.7.x then please check our other PythonScript plugin.
Its good practice to for example put check like this in your Application.Open event, like for example:

Sub Open()
If not Python3Script.PythonIsFound() then
MsgBox "Correct Python installation was not found on this machine"
Quit()
else
Python3Script.Init("TestApp")
end if
End Sub
And then your close event would look like this:
Sub Close()
If Python3Script.PythonIsFound() then
Python3Script.Finalize()
end if
End Sub

#### See Also

Python3Script Class