If I could just make suggestion. I wouldn't make an issue about her doing it overnight in her own room, in private. That alone can cause anxiety. Most children do this and it's harmless activity.
I would only focus on teaching her that it is something that should only be done in private, and let her know it's ok, as long as she keeps it private.
All the best to you.
My daughter is 7 and we are fighting this battle at home. How to tell her why she can not do this overnight in her room. She started this at a young age. I too think it is anxiety. We moved to a new state, a new home and now a new school. So far I have not heard of her doing this in class but she does it in front of her 6 year old brother while watching TV or going to bed. He now makes comes about it and tells her it's gross. I've spoken to her gently about it. Asking why she needs to do it, all she says is I dont know if just feels good. I often find her asleep this way and in the night will move her around and cover her up. My husband and I are very worried about it continuing on to adolescence. She has never had problems with OCD and is also at the top of her class. We are desperate for ideas on how to help her without hurting her.
My daughter is 9 yrs old and doing this to but at school. I have told her not to do this in public. But she still did. I made appointment with pschologist today and what else do i do. Im so upset over this people/parents will tell there children not to be friends with my daughter. They will tell there kids that im daughter is nasty. But i know she is just exploring but your know how other people talk. But if you have any advice for me i would appreciate. Thank you betty