Is it possible to make a script run constantly?

What I am hoping for is to make a small script that takes a certain usb input that would be used for head tracking, and be able to apply it to any 3d situation using opengl. In this way, I could make a headset that I sell, including the tool for replacing directx with opengl, and this script. I just wanted to make sure this is possible.

R.S.V.P and thanks in advance.