1.download the yocto source and go to ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc
2.add the following line:
IMAGE_INSTALL_append = " python python-paho-mqtt"
3.go to ./meta-swi/meta-swi-mdm9x28/conf/machine/swi-mdm9x28.conf
change UBI_ROOTFS_SIZE ?= “48MiB”
For the python recipes, you can see
https://layers.openembedded.org/layerindex/branch/morty/layer/meta-python/