WP has a get_template_part () function that connects files from the selected theme.

And how to connect the file from the plugin in the same way?

With plugin_dir_path ()?

    1 answer 1

    Usually do so. In the main plugin file define a constant

    define( 'MY_PLUGIN_PATH', dirname( __FILE__ ) ); 

    and further they use the paths relative to it:

     require_once MY_PLUGIN_PATH . '/includes/class-main.php';