In reply to zahibe:
You have conflicting requirements. You say you want to run your function at the main_phase, and then you say you want to run once in the run_phase.
You can call any function at the beginning of each phase. There is no need to wait for it.
task run_phase(uvm_phase phase);
Maybe there is more to your issue you haven't stated.