import/export JavaScript function between liquid files

Hi,

I am having an issue about JavaScript function that uses liquid variables.

I have a liquid file called “x.liquid” and its’ content:

// x.liquid

I want to use this function “sayHello” in other file called “y.liquid” like this:

//y.liquid

{% include 'x' %}

Is it possible to import/export JavaScript function (that use liquid variables inside) from one liquid file to another?

If so, what is the correct way to do so? because this way doesn’t work.

Thanks,
Tom