Raycast operator template working? I'm trying to understand how raycasting works in Blender, having looked at the operator_modal_view3d_raycast.py (Blender 2.78) template though, it doesn't seem to do anything?

It's likely that I'm missing something obvious, although from what I understand the modal event should execute the main function when I left-click anywhere in the 3D viewport and select the object if the ray hits but nothing happens.

Here's the template code: http://pasteall.org/206430

I'm on OSX 10.11.
Aha figure it out! I had to call the operator via the search menu.
So the process is:
1. run the script,
2. move mouse to viewport,
3. press space and search for raycast.
4. chose "View3D: RayCast View Operator"
5. click on your object