Could you rephrase the content of the second sentence so I have some idea what you're actually seeing?
And tell me how you know the PIR and script "work"...
Cheers!
[edit] If I go out on a limb and assume that the test script is what works, then the probability is the run time script isn't running.
Try running the following command when you think the pir_run.py is running:
ps aux |grep pir_run
The response should look like this:
Code:
pi@bpints ~ $ ps aux |grep pir_run
root 2939 0.0 0.1 5080 1400 ? S 2018 0:00 sudo python /home/pi/pir_run.py
root 2964 0.0 0.4 16916 3824 ? Sl 2018 0:05 python /home/pi/pir_run.py
pi 14789 0.0 0.1 4044 1584 pts/0 S+ 20:40 0:00 grep --color=auto pir_ru
pi@bpints ~ $
If you only get one line that's actually the query itself, and the most likely problem is the pir_run.py startup command is in the wrong LXDE startup file.
We used /etc/xdg/lxsession/LXDE/autostart for
Wheezy but
Jessie and
Stretch need to use /home/pi/.config/lxsession/LXDE-pi/autostart.
Cheers!