Sage9 How to set custom function and use in page specific js

I just want to know where and how to put own custom JS function in after choose.
I tried to set function in Common.js an fired on Home.js, but it returns error “is not defined”.

Home.js knows nothing about common.js. If you want to call a function from Common in home, you have to export the function in common.js and import it in home.js.

@Bruno I see, what is the right way to exporting and importing between those files?

@Bruno I can import function from outside of routes folder something like this:

#assets/scripts/export.js
export default function () {
  alert('hello');
};

#assets/scripts/routes/home.js
import hello from '../export.js';

but errors when i do the same from common.js