Xbee MicroPython problem with xbee.receive() in serial communication (API 1)

Hi everyone, I have a request for help.
The following code executes correctly in API mode “MicroPython REPL [4]”. Since I want to ensure that the module communicates with the microcontroller I change the API to Mode Without Escapes [1].
The MicroPython program executes correctly but bypasses operations related to receiving data from the xbee and processing it (in the example I omitted).
All other functions execute correctly and MicroPython sends data to relay.SERIAL. From the serial console I can send frames to MicroPython.

import utime
import xbee
from xbee import relay

def print_all(message):

def relay_ble_transmit(message):
        relay.send(relay.BLUETOOTH, message)
    except OSError as e:

def relay_serial_transmit(message):
        relay.send(relay.SERIAL, message)
    except OSError as e:

while True:
    received_msg = xbee.receive()
    if received_msg:  print_all(received_msg['payload'.decode()])


The radio is not set up to use both API mode and Micro Python mode at the same time. You can use one or the other.

Thank you for your reply.