Slicer does not respond while working on a code and after finishing the loop prints everything

Hello all,

I implemented a function that reads the DICOM data from a source on web (by looping over the API’s of the web service) and writes them on disk if needed. In the code I wrote "print"s in each iteration of loop to know where the current state is and which image it is fetching.
But once running the function, Slicer does not respond and print nothing (but works in the background with fetching folders to disk) and once everything is done it prints everything it was about to print from beginning.

I was wondering what is the issue, and can I do a workaround for that?

Best wishes,
Saeed

The issue is that the GUI does not update while this is being done. If you do slicer.app.processEvents() calls between the print statements, they will appear.