Import functions from Each other

Hello guys. Noobs question.
Gnome extension related question.
Can two js file import each other? Is it allowed.

For example: I have a.js and b.js.
Can I have lot of functions in b.js needed by a.js .
so a.js import b.js

But i need 1 function in a.js that is needed by b.js
can i do b.js import a.js as well?

For example

a.js

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const B = Me.imports.b

123() {
    B.xyz();
}

456() {
    B.qwe();
}

789() {
    somecode
}

b.js

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const A = Me.imports.a

qwe() {
   somecode
}


xyz() {
    somecode
}

asd() {
    A.789();
}

Is is ok to do this?
If not what are the alternatives.
Please elaborate as I still new and learning.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.