Add invoke_method to generator.