So you want to use the same key, but do different things in tf2?
Well, it's not that hard. Just follow this simple guide.
If you want a key to do something different between classes, make a reset.cfg file and add it to your cfg folder. You will add all the unbind for each key in this file that will be shared between classes.
A simple example would be:
Inside the reset.cfg file add:
In every class file (ie. scout.cfg, spy.cfg, soldier.cfg, etc) add on the top:
If you want the scout and spy to share the space key,
Add to the scout.cfg file:
alias "whatever" "do something different from spy"
bind space "whatever"
Then for the spy add to the spy.cfg file:
alias "whatever2" "do something different from scout"
bind space "whatever2"
The "do something different" is not a real command so you need to change this to something you want to actually do. Remember, add an unbind to the reset.cfg for each key you want to be different between classes. You can add anything you want to change when switching classes to the reset.cfg file.
See my other tips for tf2 scripting on here or ask a question in the comments.