flip_h
doesn't appear in this code.
Regardless, "null instance" means that you are attempting to access flip_h
on an invalid node. Typically this is because you have the name or path wrong.
$Sprite.flip_h = true
Would give this error if there were no child node named "Sprite".
PS - you can format your code using the "Code Sample" button at the top of the input form on this site.