Actually I came up with an idea and it worked. I will share this so anyone can use that. Not sure how bulletproof it is thou.
This is snippet from my content.js
var script = document.createElement('script');
script.src = chrome.runtime.getURL('injected.js');
script.id = chrome.runtime.id;
script.classList.add('rmd-block-extension');
(document.head || document.documentElement).appendChild(script);
This is snipper from my injected.js file
var extensionSrc = document.querySelector('script.rmd-block-extension');
if (extensionSrc) {
extensionID = extensionSrc.id;
extensionSrc.remove();
}
and this is how I can access extension id.
If you have better idea let me know.
Cheers.