Generally flight attendants don’t actually care if you use the lavatory while the seat belt sign is on. They have to tell you that the seat belt sign is on. They cannot tell you it is ok for you to use the lavatory.
That’s the practical real world answer. What about the law?