How to Run a Macro without cleanup python object after running

Hi guys,
I am writing a python scripts with a PyQt Dialog, It works well through pythonShell->run scripts, then I try to add it as a macro for convenience, It seems that PyQt object get cleanup right after macro run, and the dialog disappeared.
So is there any way to make python object alive like InteractiveConsole?

btw, I am trying to add a custom toolbar for more friendly user experience(through this trick), it looks like this:

Accidentaly find the solution:)

Just load .py file containing PyQt code as a Plugin.
If this plugin is marked auto load, then everty time ParaView startup, the dialog will show up.