Got it working with function now. Phew. Stupid me. All i had to do was to change my formerly action to a function. And add the action to start the function then

A bit strange though that i need to check the keypressing twice.
Code:
function Rotate_me()
{
while (1)
{
if (key_a)
{
my.pan += 2 * time_step;
}
wait (1);
}
}
action rotate ()
{
on_a = Rotate_Me();
}