It is important to note that it would not only be inappropriate but also illegal to lock a child in a bathroom, regardless of their behavior. If you’re struggling with a similar situation, there are better solutions. For example, suggest the parents or guardians of the toddler distract the child with a favorite toy, a game or a song. Or, if possible, the flight crew could be notified so they can potentially offer suggestions or assistance. If it’s a long flight, check if there’s a possibility to change seats to someone who is not bothered by the noise.