I am not able to explain why that doesn't work, you should get some errors, but this works:
I have added alert statement to debug it if not. You can safely remove it.
myEditor.addCommand(
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyP, // Ctrl+P or Cmd+P
function () {
alert()
// Trigger the built-in command palette command
myEditor.trigger('keyboard', 'editor.action.quickCommand', null);
}
);