Sometimes you need to discuss nudity a bit earlier.
When DS1 was maybe 3, he was having a bath, and a (male) friend and I were in the room chatting.
DS1 wanted me to get into the bath, so I had to explain that yes, I could, but that my friend would have to go away, because, well, just because ...