Hola si me di cuenta pero el error continua:
  Código PHP:
    <?php
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
            'cache' => 'cache',
            'debug' => 'true'));
# Esta es mi funcion
//$twig = new Twig_Environment($loader); //Aca se declaa por segunda vez
$function = new Twig_SimpleFunction('function_name', function () {
    // ...
});
$twig->addFunction($function);
/*----------------------------------*/
            
$template = $twig->loadTemplate('index.twig.html');
echo $template->render(array());    
   Código PHP:
    Fatal error: Class 'Twig_SimpleFunction' not found in ... 
    
  Es como si la clase "Twig_SimpleFunction" no existiera.