EDIT: It turns out that because the script is supposed to take a screenshot, it cant because it starts too early. I thought that it was not the script having problems because it worked fine not on startup.
I am trying to run a python script on startup on linux on a RPi-4. I have tried adding it to rc.local as
/usr/bin/python3 /path/to/script.py &
When I rebooted, nothing happened. I also tried to put it in crontab:
@reboot /usr/bin/python3 /path/to/script.py &
Still nothing happened. I have this line at the start of the script:
#!/usr/bin/python
The script definitely runs without any problems just calling it normally through terminal. Any ideas?