shud wurk
alias classswitch "class1"
alias class1 "join_class pyro; alias classswitch class2"
alias class2 "join_class soldier; alias classswitch class1"
bind "[key]" "classswitch"
Alternatively, you can bind your keypad (if you have one and not in use for other binds) to different classes.
bind "KP_END" "join_class scout"
bind "KP_DOWNARROW" "join_class soldier"
bind "KP_PGDN" "join_class pyro"
bind "KP_LEFTARROW" "join_class demoman"
bind "KP_5" "join_class heavyweapons"
bind "KP_RIGHTARROW" "join_class engineer"
bind "KP_HOME" "join_class medic"
bind "KP_UPARROW" "join_class sniper"
bind "KP_PGUP" "join_class spy"