I use Debian and the gnome desktop environment.  

You can set custom keyboard shortcuts.   

For example I did [crtl+alt+t] for opening a terminal.  

(the command for this is called "gnome-terminal")   

And that works.  

But when I try to bind the key [F11] to "python3 /somefolder/myscript.py" and I press F11 nothing happens. (when I type the command in a terminal it works but not with this keyboard shortcut)