We were able to use Supervisor to successfully have a Python script run in the background on boot.
Tutorial I Used to set it up: Monitoring Processes with Supervisord
Supervisor runs as a service, and you have a configuration file where you set up your scripts that you want it to run:
You could either have Supervisor run your vending machine scripts on start up or start a script that is waiting for your button press which would then launch your main vending machine script.
Steps: (Using terminal)
sudo apt-get install -y supervisor
Start the service
sudo service supervisor start
Create your configuration information:
sudo nano /etc/supervisor/conf.d/yourscriptname.conf
Enter the configuration information and save the file:
Update Supervisor to include your new configuration file:
See if your service started:
Start and stop the your script from running:
supervisorctl stop your_script_name
supervisorctl start your_script_name