How can we use(reuse) one template inside another template

I have made one Template and its helper. now I want to use that template inside another template to reuse the helper functionality and html.
is it possible?

<template name = "some_template">
     // some code

<template name = "another_template">
    //Events are working but helpers.

A helper is just a function. You can define a function in another file, import it into a template and assign it to your template’s helper map.

I have made an object

file: one.js
someObject ={ function one(){ // }, function two(){ // } }

file: one.html
<template name="someTemplate"> // </template>

file: two.html
<template name="another_template"> {{>someTemplate }} </template>

You’re response is highly ambiguous. I’m not sure if you understand what I’m trying to convey or not.

I understood what you said, i just asked whether what i wrote is a possible workaround or not.

You could use an object if you want to use all the same helpers for both templates, but i suspect that isn’t the case…

I would personally use something like so…

// shared-helpers.js
export const someHelper = function() {
    //do something awesome here
// some-template.js
import { someHelper } from './shared-helpers.js';

// another-template.js
import { someHelper } from './shared-helpers.js';


I am just trying to create a common reusable component so that I don’t have to define


I just want to call template like this

<template name = 'another_template'>

This is working perfectly for events but cannot call helpers of someTemplate in this file.

Is it the helper you want to embed, or the entire template?

Have you tried a global helper?
// /imports/startup/client/shared-helpers.js
Template.registerHelper(“one”, myHelperFunc);

1 Like

I didn’t know about the global helper. I have made a file shared-helpers.js, now how can I access global helper in my code.
I want to use the entire template as a part of another template.

Global helper worked for me thanks for the help.

Thanks for the reply now i got it what you were trying to say. The global helpers worked for me.