How to use python to copy image poroperties from the compositor to the 3D viewport

I’m trying to write a script to copy image properties from the a node in the compositor to the background image of a 3D viewport.

By naming the image node and the background, I’ve managed to change the image in the 3D view e.g.

>>>["background_b"].filepath =["Moon.b1"].filepath

However, I’m stuck with the start frame and offset, which seem to be properties of ImageUser. The tooltip says


which, as far as I understand, means I need to put something between [“Animation.back”] and .frame_start but what is it?

Can anyone tell me the proper syntax to reference:
a) the frame_start and frame_offset for the background in a 3D viewport, and
b) those same properties from an image node in the compositor?

Any pointers would be much appreciated.

UPDATE: I’ve worked out the node references - e.g.


Now I just need the referenceS to the 3D viewport background.

OK!!! I worked out the rest thanks largely to this post:

Here’s an example:


Obviously, finding the “areas[5]” took a bit of trial and error, as my screen has 10 areas, five of which are 3d viewports.

I have to say I’m surprised that this hasn’t come up before - seems to me that duplicating a video background node in a 3D viewport would be a common need.