There is no need to get the session_id and then call virsh.command by passing this id. You can just use VirshPeresistent as below:
```
vp = virsh.VirshPersistent(readonly=readonly)
vp.command()
```
VirshPersistent will pass the readonly to virsh session to call the command as you want.