Based on this forum post, it is possible to include precompiled scripts (in a modules directory at build time) in the flash image. This requires the config FROZEN_MPY_DIR.
It is also possible to cross-compile using mpy-cross, but it looks like this requires some micropython source code changes (#define MICROPY_PERSISTENT_CODE_LOAD (1)), and also what looks ...
Based on what we've seen in the comments and edits, I think it might be worth setting a lower MTU for the cellular link.
Try running something like the following:
nmcli con mod "user_apn" gsm.mtu 1300
This should cause the MQTT client (in combination with the network stack) to break packets up into smaller chunks which hopefully should be able to ...
You should not be running long running (infinite loops) in the callbacks.
All the callbacks run on the client network thread's main loop (the one started by client.loop_forever()).
This means if the on_connect() thread never returns it will never get to handling the calls to client.publish() in the loop.
The individual client.publish() calls work because ...
In most cases (that is, unless you have compiled/frozen the Python code), yes.
Depending on the exact environment you may be able to just retrieve the file via the usual file transfer tools.
Alternatively, you can just connect to the REPL (console) and read the file from the filesystem:
file = open("fileyouwanttoread", "r")
This will display ...