You can create a background daemon (service)
You participated in Ubuntu 16.04, this means that you got systemd, for more information on how to configure it, visit this link
create a file called <my_service>.system and put it there: /etc/systemd/system
systemd might look like this:
[Unit] Description=my service After=graphical.target [Service] Type=simple WorkingDirectory=/my_dir ExecStart=python my_script.py [Install] WantedBy=multi-user.target
then all you have to do is reboot the system and start the service:
sudo systemctl daemon-reload sudo systemctl myservice start
source share