For that, use a custom module like here
Example : (Custom page)
return array(
'#theme' => 'tour_custon_theme',
'#user' => $user,
);
//OR with inline template
return array(
'#type' => 'inline_template',
'#template' => '{{ user }}',
'#context' => array(
'user' => $user,
),
);
If you can't do this, try to use the hook template_preprocess like:
function template_preprocess_YOURTEMPLATE(&$variables) {
}