Site icon Hip-Hop Website Design and Development

Enqueue script o fashion provided that a template half is loaded

I’ve registered some types and scripts that needs to be loaded if a template half is loaded in a template file. For ex:

in house.php

<?php get_template_part( 'template-parts/external_links'); ?>

(this template-part is loaded throughout totally different template recordsdata) due to this fact, I need to enqueue (a beforehand registered file in capabilities.php)

Utilizing template recordsdata for instance I exploit:

if(is_page_template('admin.php')){
        wp_enqueue_script( 'unicorn-admin');
    }

Is there a method to enqueue a file when get_template_part( ‘template-parts/external_links’); is used?