The utility function would be moved to the Menus file and made as a function that it exports. Then from the Default Menus and from the Recent Projects main file, that function can be called through the Menu module to create the required on click event.