Is there a way I can pop realtime message in script report?

Tried these but doesn’t work

 frappe.publish_realtime("data_import_progress", {"progress": [i, max]},
                                user=frappe.session.user)
#not sure about this, because base from the examples I got
 #I need to put data_import_progress somewhere in .js file. 
#But I don't know where/how if it's script report


frappe.publish_realtime(event='msgprint', message='hello')

This one works but only pops after the report is done returning data

 frappe.msgprint('hi')

It will show up first if you put it at the beginning of your script report.

oh I see, will try.