You can try inserting something like (untested):
comm = mpi_comm_world()
mpiRank = MPI.rank(comm)
if mpiRank ==0:
print 'hello'
Each MPI process has a unique MPI 'rank', which is stored in mpiRank in the above. Then you can use an if statement to tell different processes to do different things.