How to fix this drop weapons?

Hello i have tried to avoid starting a new thread and see if i could figure it out but i cant. I have been following http://www.youtube.com/user/d123s404?feature=watch and his tutorials on how to make a picking up, equpting and droping weapons tutorial. and on this part http://www.youtube.com/watch?v=IwPrWKADgOs messed me up. What happens is when i start the game everything works fine. except when i pick up a weapon and try to drop it. I thought the console would show an error but there were no errors. everything works except for the dropping part. I tried for at least a few hours testing and testing but it seems not to work. I think that the

keyboard = bge.logic.keyboard
q_key = bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.QKEY]

is not working. i dont know why. but when i open another blend file with the same type of code it works. Please help me this is really frustrating. here is the blend file:

gunSwapping_TutStartup.blend (552 KB)

I think your problem is that you have q_key and e_key using the events from the sensor"Keyboard" that is only activated when you press the W Key. So it will always say that q_key and e_key aren’t being pressed.

Well the thing is i don’t have the keyboard sensors hooked up to the script, so i don’t know why it would be doing that, is it a bug in blender? I forgot a line of code that is that the

keyboard = bge.logic.keyboard
q_key = bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.QKEY]

I had just assumed you did, sorry. What you’ll want to do is add a python controller to your logic brick setup and set it to module mode. Then in then type in the name of the script and the module you would like to run. Then hook that controller up to an always sensor set to pulse.

It worked! Thank you so much.