For a simple illustration, I have this code in the text editor. This is then inputted in the driver editor. It works, initially. However, when I move the driver, in this case the Sphere, It no longer works.
I have to click update dependencies for the current state of the Sphere to affect the driver.
def drive_me(count):
val = bpy.data.objects["Sphere"].location[2] + count
return val
import bpy
bpy.app.driver_namespace["drive_me"] = drive_me
Hey, You have a warning message “Python restricted for security” - my guess is that you do not have “Auto run python” enabled in the user prefs, take a look and see if that is the case.
Ummm, prob not the same, in the user prefs there should be a box to check to allow it, not on 2.8x so I will have to look thru the manual to find the location.
EDIT; after looking in the manual ,I think you are correct.
As far as your issue goes, add a variable(does not matter what) that points to the object that you are using the input of - it’s an old hack but works.