Yup. I threw my test code in the top of the Hello Dolly plugin and there was the notice.
That’s when I remembered that I was calling it within a namespace:
So needed to referenced that so the WP action could access it:
namespace My_Plugin;
function my_mwe_admin_notice(){
echo '<div class="notice notice-error">';
echo '<h1>Notice this.</h1>';
echo '</div>';
}
add_action( 'admin_notices', __NAMESPACE__ . '\\my_mwe_admin_notice' );