The variables within the tst method are local, that is, they refer to different values that only exist inside scope of that method. Use the keyword global (as in global A,B,C,D) inside tst to fix the behavior. See an example here and the question here.