Site icon Hip-Hop Website Design and Development

Template not loading with get_template_part or locate_template

I have this simple template in a my_template.php file:

<div class="popup_canvas_container">
    <p>This is a template I'm gonna load</p>
</div>

And I implemented this function to load the template from custom shortcode:

public static function load_template($atts) {       
    function load_my_template() {
        ob_start();

        //if ( file_exists(TEMPLATE_MODULE_DIR . 'my-template.php') ) {
        //  include_once( TEMPLATE_MODULE_DIR . 'my-template.php' );
        //}


        get_template_part('my-template');
        //locate_template( TEMPLATE_MODULE_DIR . 'my-template.php', true, true );
        
        return ob_get_clean();
        
        //global $wpdb;                     
        //$current_user_id = $wpdb->get_var( "SELECT user_email FROM newk3_users WHERE user_login = 'xxxxxx' " );       
        //$result = "<div class='box_external'><p>$current_user_id</p></div>";
        //$result = "This is return";       
        
        //return $result;
        
    }
    add_shortcode( 'site_template', 'load_my_template' );

If I use include_once the template would load in the page but if I use wordpress’s functions like get_template_part or locate_template it doesn’t load the template… since with include_function works I thought maybe I missed something else, even if I put also the complete path to the template file…. could you give me a direction?

Thanks in advance to everyone!
Cheers
Luigi