Binding keys to actions in a different namespace

I have a working cascading menu Widget that supports hotkeys and arrow navigation, I want to bind the arrow navigation keys to action_ methods that are in the Widget, not in my main app, but it was not obvious now to bind to methods not in the application namespace. I now have this working by:

  1. From within the Menu widget init, modify the parent app to be able to see actions in the ‘menu’ namespace via the .app property
        # Allow the application to access actions in this namespace"menu")
  1. Binding the keys to the new methods, again from within the Menu widget via the .app property
        await"escape", "menu.menu_escape", show=False)
        await"down", "menu.menu_down", show=False)
        await"up", "menu.menu_up", show=False)
        await"enter", "menu.menu_enter", show=False)

So far this works if the menu widget is named “menu” e.g. = Menu(), but it feels ‘hacky’ as it requires me to make sure the menu widget is called “menu”. I supposed I can pass in the name when instantiating and adjust accordingly, but it still feels like there should be a better way to be able to bind to a method in a different namespace. Any other approaches or ideas?

(if interested, code is here, needs cleanup - but it is working as POC for menus, modal dialog and a live updating status bar. Today - only the “Increment” menus are active, and only the first one actually has callbacks that do anything)