Is it possible to put a function somewhere other than the functions.php file?

Since you are using init “add_action”, then it is best not to use it in a template – since “add_action” is used by WordPress core’s “do_action” – which comes before the templates.

If you want this function to take higher priority, place it in functions.php but use the ‘priority’ variable of “add_action”:

add_action( $tag, $function_to_add, $priority );

The default priority is 10. See more here

Alternatively, if this is relevant only for a specific template, then I don’t think you need add_action at all – or even a function for that matter.

Simply place the inner code of your function BEFORE get_header() in your template:

if(isset($_POST['region']))
{
    // Set Cookie
    setcookie('region', $_POST['region'], time()+1209600);
    // Reload the current page so that the cookie is sent with the request
    header('Region: '.$_SERVER['REQUEST_URI']);
}