php – Use wp_head hook on template page

I try to use the hook wp_head on a template page but this does not work

add_action('wp_head', 'to_head');

function to_head(){
    //do stuff

I place this code on a template part what is called by get_template_part( 'temp-parts/content/pages/catalog' );

Can you use the hook only on the functions.php or is there a way to use this on any page