Importing a Function from masterPage.js into Page

Howdy, I got a search bar in my Header that I would like to redirect to a dynamic page. In laymen’s terms I am trying to access masterPage.js data in the website page code.

import {function} from "masterPage.js"; 
or 
import {function} from "backend/masterPage.js"; 

This a idyllic method of accessing the masterPage, but obviously the said method doesn’t work since the masterPage.js isn’t considered a built-in module or back-end code. How can I get the data from the masterPage to use on my website? Is it even possible? Did Wix restrict accessing masterPage.js data? I know that Wix doesn’t allow images in the Footer, but I would assume that the Header would be more accessible since there are too many things that would need it to be connected to other parts of the website.
Can somebody help me plz? Thanks and God Bless :slight_smile:

Ok, let’s make your wish come true!

How can I get the data from the masterPage to use on my website?

Already used or heard about → PUBLIC-JS-FILE?
Create a PUBLIC-JS-FILE → yellow-one <— instead of trying to do it on backend…

import {function} from "backend/masterPage.js";

Written functions on PUBLIC-JS normaly should work on MASTER-PAGE aswell as on normal pages.

You may also consider to use → wix-storage.

Does this work for cart page??