Make one button (mouse or keyboard) Do two different things
In Blender hotkeys are devided in areas, that you can see in the User Preferences.

While your mouse is hovering over a certain area (for example the 3D Viewport or the UV Editor), that area is the active one, and when you press a button it will use the command of that specific area.

For example, when you press Alt + P, if your mouse is in a 3D View window, it will bring up the Clear Parent menu, while if it is in the Text Editor it will execute the Run Script command.



To change an hotkey for a specific window (let's say the UV Editor) you need to go in the User Preferences>Keymap>Image>UV Editor and modify/add your hotkey.



In your question you mention the "modeling tab", so you are speaking of the Workspaces in Blender. These are just different ways to arrange the different windows/panels in the UI, they are not different sections of the software: a 3D Viewport is the same in all workspaces, therefore all hotkeys will remain the same across different workspaces