What is the expected format fo scripted drivers?
It expects to not use direct data path but to use a variable like this:



The reason is for update purposes. With variable the driver knows what his dependencies are thus it knows what value to watch. Watching the whole bpy.data for changes is not efficient.

Here are examples what is allowed in the Expr. field. You can use number expressions with driver variables plus some build-in functions like sin, cos, min, max, frame, etc.(to see all of them put bpy.app.driver_namespace[' into console and hit Ctrl+Space)

You can also use custom python functions, where you can access bpy.data, but you need to add such functions to driver namespace first:

import bpy

def mazda_loc_y_func():
    return bpy.data.objects['Mazda'].location.y

# add function to driver_namespace
bpy.app.driver_namespace['mazdaY'] = mazda_loc_y_func


In the Expr. field you just type mazdaY(). Without the driver variable the driver might not update nicely though.