I'm running a python script from LAMMPS input script which does file handling. I want only rank 0 to execute it. I didn't find how to do this in the docs, but one solution was to load MPI4Py in the script and do the test on rank there.
If this is solution that you think will always work, it could be nice to mention this in the docs.