Changing workspace with python I want to make a python script that allows me to change my workspace with a keypress, and I have a wacom tablet with buttons on it that I can map keys to it. I was thinking about mapping unused function keys to my tablet and having my python script listen for the key and change my workspace accordingly 

(for example, the 3rd button on my tablet triggers f5 which a python script would listen for that and change my workspace to shaders) 

Is there a specific command for changing the workspace in Python?

(Note: I am a noob at python, I use Lua more)
Here is a quick solution, which allows you to change the workspace from Python:
bpy.context.window.workspace = bpy.data.workspaces['Layout']
All the available workspaces are stored in bpy.data.workspaces, so you need to pick one from those.
Now it is just a matter of putting your favourite into a Python script and register it as an operator, so you can map a key to it :)
Good luck!
EDIT:
As promised, a simple addon file: github blender-workspace-swapper
It does not contain keymaps yet (to be fair, I am not sure how those are created for addons, maybe someone else could help?), but calling the operator via the operator search works.
Alternatively, calling it from the python line like this:
bpy.ops.workspaceswapper.swap(targetWorkspace=&quot;Animation&quot;)
If the workspace does not exist, it will append it from the startup.blend in the config folder (make sure that one exists).