So I'm fairly new to the Blender API, and I have a script that needs to be run every time the 3D cursor is moved. I can get the current location with bpy.context.scene.cursor_location, but that's only usable from the script itself.

Can this be used to trigger my script?


1 Answer 1


A quick and dirty solution would be to use a scene_update_post handler.

Event handler access in Blender.

import bpy
def my_handler(scene):
    cursorLoc = bpy.context.scene.cursor_location
    # do something


Run the script once, then your function will be called as soon as the scene updates.

This is highly inefficient and will affect the performance depending on the design of the script. It provides an easy solution though and Blender was always fast enough for me to not notice a difference.

  • 1
    $\begingroup$ I read that scene_update_post has recently been depreciated. Do you know what the equivalent is now after Blender 2.80? $\endgroup$ Commented Jul 31, 2021 at 0:46
  • 1
    $\begingroup$ Did you read this? $\endgroup$
    – Leander
    Commented Aug 3, 2021 at 17:02
  • $\begingroup$ Here's a hack solution maybe it helps blender.stackexchange.com/questions/283247/… $\endgroup$
    – Harry McKenzie
    Commented Jan 9, 2023 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .