How to display a loading animated gif while a code is executing in backend of my Python Qt5 UI?

You should take a look at this tutorial (in French) about throbbers.
http://python.jpvweb.com/python/mesrecettespython/doku.php?id=pyqt5_throbber