Document.querySelectorAll data passed between scripts?

Hi, I am having trouble passing data from “document.querySelectorAll” which is in my content script (docs.js) to my main file index.js. I have read the documentation but am still unsure and keep hitting a brick wall?

help please?

Content scripts and chrome scripts can only communicate using message passing and serialized data. You shouldn’t be passing objects to the main script, only data. If you need to do any processing for those objects, you should do it in the content script.

Thanks for this