How could I reboot my board with yocto using a python script? Is there any command that allows me to restart the board?
You would need to read the documentation for your board to find out how
to restart it, and then read the documentation for yocto to find out how
to give that command.
Python doesn’t really come into this; it is a matter of the board’s
capabilities. If it supports restarting, then you could probably use any
language to restart it (with a bit of help of a library like yocto). If
the board doesn’t support restarting, then Python can’t force it to.