Hello Rahul Reddy ,
Yocto allows you to build a Linux root file system for your board. You may run post-scripts while building your image in Yocto as part of the image recipe, is this what you’re looking after? It would seem that you rather want to run a script on the Qt image, which would be a different procedure and you would need to make sure that you have Python installed on the Qt image.
There is not an official Ubuntu BSP for the i.MX6, however, you may follow the instructions on the following document to load an Ubuntu RootFS on the i.MX6.
Installing Ubuntu Rootfs on NXP i.MX6 boards
Regards,