I understand how I can define a driver function and add it to the driver namespace:
import bpy
def driverFunc(val):
return val * val # return val squared
bpy.app.driver_namespace['driverFunc'] = driverFunc # add function to driver_namespace
How can I execute this script when loading the blend file? This would be required to use the newly defined function in a scripted expression of a driver. I don’t want to put it into the startup script as that would make it available to all blend files, but only on this installation, which prohibits distirbution of the file.