It's possible to modify most of an object's properties arbitrarily in a driver.
For example, the below driver, when placed on an object's X location transform, will copy that object's Y location to its Z location on every frame:
[0, self.location.__setitem__(2, self.location[1])][0]
Is there a known way to do the same when the property that is to be modified belongs to another driver?
E.G. The below code works to set the target of a variable on the driver of an object's X location when evaluated in the console, but not when evaluated in a driver on its rotation channel:
[setattr(self.animation_data.drivers.find('location', index=0).driver.variables["var"].targets[0], 'id', self),0][-1]
.location
affects.matrix_world
but doesn't actually affect.location
... It seems that evaluation and thus assignments for drivers are probably done in a restricted context that gets used to update matrices and such used for display/rendering, but cannot manually affect scene data. $\endgroup$.matrix_world
, but not.location
, so there does seem to be some separation in how drivers are evaluated that restricts what they can affect. (It's changes to.location
presumably get used by Blender to compute.matrix_world
, but don't directly make it to the scene data.) I fully expect race conditions on single frames with this abuse, but I still should be able to see the changes in the UI or Python console if they're actually working. $\endgroup$