PyCall can in principle patch sys.stdout etc. like ipykernel does, so that writing to it can invoke Julia’s IO. But calling sys.stdout.flush (or pass flush=True to print in Python 3) in your script is a more robust solution as it would work in other contexts like piping into a file.