How do I get my cat to use a cat flap?

This is not real in case you though it was. I just liked the image.