How can the receive buffer be cleared/flushed before using readDataFrom(...)?

Is there a way to flush the receive message buffer before calling the readDataFrom function? If it is not flushed it may contain older messages from before the command.

I just ran into the need to flush the receive buffer during a reboot. There may be an easier way to do it.

flush old messages prior to your main loop

received_msg = xbee.receive()
while received_msg:
received_msg = xbee.receive()

while True:
# Your main loop