Trying to write a function in an external php file to manage admin menu visibility

It’s becouse you’r calling alter_item function outside action admin_menu

here’s working example i just made, try to figure what’s wrong with your’s by your self, if you fail i’ll explain

add_action( 'admin_menu', 'alter_items' );
function alter_items() {
    global $current_user, $menu;
    get_currentuserinfo();
    $scopes = apply_filters( 'alter_items', array() );
    if( ! empty( $scopes ) ) {
        foreach( $scopes as $scope ) {
            switch ($scope['action']) {
                case false:
                    if ($current_user->user_login == $scope['user']) {
                        remove_menu_page( $scope['items'] );
                    }
                    break;

                case true:
                    if ($current_user->user_login == $scope['user']) {
                        //Do something else
                    }
                    break;
            }
        }
    }
}
function alter_menu($user, $items, $action) {
    add_filter( 'alter_items', function( $scope ) use( $user, $items, $action ) {
        //echo '<pre>'; var_dump( $user, $items, $action ); echo '</pre>';
        $scope[] = array(
            'user' => $user,
            'items' => $items,
            'action' => $action
        );
        return $scope;
    } );
}

alter_menu('admin', 'plugins.php', false);

PS: note that you need PHP 5.3.0 minimum