- I have assigned a script-expression driver to a field in a modifier.
- The expression is a function of properties of the object to which the modifier is assigned, extracted as Single Property variables.
I can CtrlL link the modifier to a new object. I can copy the driver from the old object's modifier, and paste it into the new object's modifier.
But, of course, the driving properties still refer to the old object, and so I have to go in and manually point the variables in the driver to the new object.
How should I use 'self', or suchlike, either in an expression, or in a driver-namespace function, so I can copy the driver between modifiers on separate objects, always referring to the object the modifier is assigned to?
EDIT:
I've just worked out that self in an expression driving a modifier field, refers to the modifier, not the object the modifier is assigned to.
AND YET, if I create single-property variables to be used in the expression in the UI, the root is the object. For example, to reach the value of a field in the driven modifier that way, I use modifiers["name"].modifier_property.
This makes no sense to me at all...

bpy_structwith a bit more understanding. I often wish the documentation for this and other APIs would kick off with more of a view from 30 000 ft - How to look at the data structures / database, in plain language, before considering how to use them. – Robin Betts Jan 09 '19 at 08:28str(obj)Consider<bpy_struct, Object("Cube")>an instance ofbpy.types.Objectnamed "Cube". Printingrepr(self.id_data)would returnbpy.data.objects["Cube"]– batFINGER Jan 09 '19 at 09:07