Yeah... I don't think that is going to work.
Try moving the entire function to your main functions.php file... just for testing sake.
Moving it there should run it at the proper time. We can check to ensure it works... then we can go about adding it from an external file.