So I dont know if its the best way but my problem was the if statement surrounding the require_once on the necessary files that contain the function. Commented out the IF statement and it did the trick. I’ll go have that coffee now 😉
//if (!function_exists('wp_generate_attachment_metadata')){
require_once(ABSPATH . 'wp-admin/includes/image.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
//}