Execute Python script between rendering animation frames
You can loop through frames and render each one and do whatever you want before rendering the next one like this:

import bpy

s=bpy.context.scene

s.render.resolution_x = 512 # just for my example
s.render.resolution_y = 512

for i in range(s.frame_start,s.frame_end):
    s.frame_current = i

    s.render.filepath = (
                        "C:\\temp\\" # some path
                        + str(s.frame_current ).zfill(3)
                        )
    bpy.ops.render.render( #{'dict': "override"},
                          #'INVOKE_DEFAULT',  
                          False,            # undo support
                          animation=False, 
                          write_still=True
                         )

    # Do whatever you want here
    # Changing render resolution is one of the things imposible to do with
    # handlers while rendering an animation so let's do that

    if s.render.resolution_y == 512:
        s.render.resolution_y = 256
    else:
        s.render.resolution_y = 512


The problems start if you want to see the render happening in the UI. If you uncomment 'INVOKE_DEFAULT' it breaks everytihing because the script is unable to know when the started render finishes. People have tried to work around that, but things get ugly from here. See this question if you want to pursue this.