Why ask me?
You are the one with all of the code...
Just test it.
You need to call your method self.draw_beam() within the onMouseMove method - probably after you've test for a certain 'state' being reached - e.g. perhaps initially 'draw_beam' doesn't kick in with @state=0, but after you have done some other stuff when you've then set @state=1 - then in the onMouseMove method the line would be self.draw_beam() if @state==1 etc, later on, perhaps after you click again, you'd set @state=2 so then the 'draw_beam' stops...