I heard this phrase: Thank you for having me in some American TV shows. I have noticed that it is sometimes used when a guest is thanking the host. So it seems to mean something like Thanks for inviting me, right?
My question is: Does this expression sound OK in contexts otherwise than a TV show. Is it used in other situations?