How to add_menu_page include a php file page from theme directory

Fifth parameter of add_menu_page is of type callable. So you can’t just give it “test.php” and expect it to load. But you could probably do something like:

// Include the fine with some function for example bananaMonday() declared
include_once( __DIR__ . '/test.php' );

// And then use it as param for add_menu_page
add_menu_page('Test', 'test', 'manage_options', 'test', 'bananaMonday', null, 6);

So in the end your full code would be something like this.

functions.php

function se331925_custom_menu_page() {
    // Include the fine with some function for example bananaMonday() declared
    include_once( __DIR__ . '/test.php' );

    // And then use it as param for add_menu_page
    add_menu_page('Test', 'test', 'manage_options', 'test', 'bananaMonday', null, 6);
}

add_action( 'admin_menu', 'se331925_custom_menu_page' );

test.php

function bananaMonday() {
    echo '<h1>Hello, it\'s monday';
}