The MicroPython REPL banner (which starts with e.g. "MicroPython v1.12-xxxx-gxxxxxxx") can tell you which MicroPython release version is used on the XBee.
You mention that you are using "version 4" of MicroPython. According to http://docs.micropython.org/en/v1.12/reference/mpyfiles.html , MicroPython v1.12 uses bytecode version 5. (You can also confirm this on v1.12, by checking the last field in sys.implementation).
Additionally, when using the mpy-cross tool to byte-compile your code, you must make sure to specify the correct command-line flags to the compiler, as documented here: https://www.digi.com/resources/documentation/digidocs/90002219/default.htm#reference/r_compiled_files.htm