data.js and databaseJobs.jsw

Hi,
I follow the wix video and set up a job scheduler in the backend in a jsw file. It works.
I add an afterInsert hook to my database in the backend in a js file. It works too.
However, when I try to run the function in the jsw file through the js file. It does not.
I search through internet the difference between js and jsw file. It says that
the difference is in how those files are exposed to public code and page code. a js file is a regular backend module and is not exposed at all to client calls. a jsw file is a web module - it can be imported from client code. Is that true?
Should I call the function in the jsw file through the function in the js file?
Can any help and give me some suggestions?

Thanks
Joe

https://www.wix.com/corvid/forum/community-discussion/difference-between-jsw-and-js#targetText=The%20difference%20is%20in%20how,proxies%20to%20all%20exported%20functions.

https://support.wix.com/en/article/corvid-about-data-hooks
https://support.wix.com/en/article/corvid-using-data-hooks
https://support.wix.com/en/article/corvid-tutorial-processing-user-input-before-it-is-stored-in-a-collection-with-data-hooks

https://support.wix.com/en/article/corvid-scheduling-recurring-jobs

https://www.wix.com/corvid/forum/corvid-tips-and-updates/video-how-to-execute-timed-tasks-with-the-job-scheduler

Thanks a lot, Ninja.
The above links are quite useful.
I have one more question. Can I run a query in the “hook after insert” like the following code.
I want to use query to get additional information from another collection and then insert the data into a new collection. (It can work without the query)
It seems that it does not work. Please help to improve.

//backend data.js
import wixData from ‘wix-data’;

export function qrcodeDirectDB_afterInsert(item, context) {

let insertname;
let searchname = item.codename
var jdate = new Date(item.timestamp);
jdate.setHours(jdate.getHours() - 8);

wixData.query("runDB") 
    .eq("name", searchname) 
    .find() 
    .then((results) => { 
          **if**  (results.length > 0) { 
            **let**  firstItem = results.items[0]; 
            insertname = firstItem.teacher; 
            console.log (insertname); 

let newData = {
“name”: searchname,
“starttime”: jdate,
“teacher”: insertname
}

wixData.insert(“profileDB”, newData)
.then((cresults) => {
let insertData = cresults; //see item below
})
}

})
}