I want to execute on Page js function instead of handling all logic in extension
content script
document.addEventListener("MY_EVENT", function (data) {
   chrome.runtime.sendMessage("myextid");
});
chrome.extension.onMessage.addListener(function (msg, sender) {
 //***********
 //want to move below logic to page instead of here
 //As modifying/uploading extesion is difficult than on page js
 //what I want is call here 
 //extResponse(msg);
 //instead of below code, but it says undefined function
 if (msg.action == 'MY_DATA') {
    $('#txt1').val(msg.id);
    $('#txt2').val(msg.name);
    $('#txt3').val(msg.email);
    $('.myClass').addClass('stop-spining').removeClass('text-center');
 }
 //***********
});
mypage.html
<html>
 <body>
   <script>
      function extResponse(msg){
        //I want to handle all logic here....
      }
   </script>
 </body>
</html>
 
    