Using image sequence in external render

I’m working on implementing animated textures into appleseed. Right now I have it set so the user has to manually modify the filepath to add ‘%04d’ in place of the frame number (which appears to be a standard way of wild carding animated textures).

With Cycles you can specify an image as a sequence and it pulls in the correct file for each frame. I’m assuming it does this by modifying the input filename with the correct frame number. Is there any way to retrieve that modified filepath through Python?

You can have a look how I solved it in BlendLuxCore:
Similar to Blender, I have an “image user” class:

In every place with an image pointer, I had to also add an imageuser instance, and link their update callbacks:

On export, I use the image user to extract the required frame:

And then I use a function by Campbell Barton to resolve the filename:
https://github.com/LuxCoreRender/BlendLuxCore/blob/78329a35605ef2e5f67df620df6efadddcf449a4/utils/init.py#L579