why python script run command two times? resolved

hi 
I start to program my raspberry pi 3 

I a new in python world and I don t understand 
the goal of my script is to start application or script on key event
like if b is press start blu.py (my robot program)

the problem is when I close the script or the application , it restart a second time;
so I close it again and It s done.

I don t understand why the script run a second time the command when I close it?

I hope my english is not to bad I am french
thanks



Try adding the sleep command to delay the number of times it reads the keyboard input. It may be reading your key press more than once, causing the repetition.

LaurentP30 (author)  ThirdEarthDesign24 days ago
thank but I just resolve my problem
I add " If press :'' before the both command.
I was thinking it run once when I press and a second when I release

thanks for your time