sudo pigpiod
python 'your directory'/x-c1/fan.py &
You can put these two lines in the /etc/rc.local file so that it will run automatically after booting.
If sudo asks for a password, you can use the following command
echo 'your password' | sudo -S pigpiod
python 'your directory'/x-c1/fan.py &
<!--Add review function! -->