the_widget() inside functions.php

The function the_widget() does not return any output it only echos it. If you want to save its output to a variable you need to use output buffering.

ob_start();
the_widget('My_Custom_Widget');
$w = ob_get_contents();
ob_end_clean();

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduseduedusedusedusedusedu