Running a script AFTER the blend has fully loaded

I’m trying to do the following:
blender -b file.blend -P

I need to know when file.blend is loaded, and everything is initialized inside blender.
I’m currently in the state where the keyframe data isn’t updated, and my script is getting wrong information by querying the data inside bpy.

I’m hoping there is something can call, like:
to get everything initialized, but I haven’t found such a call…


Have you tried just leaving in the BLEND file and setting it to “Register”?

If not, try putting a sleep at the start of your script, perhaps that will give enough time for Blender to be up and running before your script starts processing against the BPY data.