Repurposed code for different button not working

Can someone tell me why, when I copy and paste this code in line, and change the button it’s referencing (changed button4 to button41 in all 3 places its referenced), why when clicking button41, the same thing isn’t executed???

This is the only reference to button4 in the page code.

Could it be something in some other code somewhere?? What can I be missing?
All I want to do is duplicate the functionality

export function button4_click ( event ) {
$w ( ‘#button4’ ). disable ()
let toInsert = {
propAvailabilityDate : data . _id ,
member : wixUsers . currentUser . id ,
availabilityDate : data . weekAvailable ,
property : data . property . _id
}
wixData . insert ( “BookingemailClicks” , toInsert ). then (() => {
let date = sortDate ( data . weekAvailable )
// console.log(“mailto:” + data.property.bookingsEmail + "?subject=Booking " + data.property.title + " from " + date )
wixLocation . to ( “mailto:” + data . property . bookingsEmail + "?subject=Booking " + data . property . title + " from " + date )
$w ( ‘#button4’ ). enable ()
//$w(‘#bookedStrip’).expand()
})
}

Try this one instead…

$w.onReady(()=>{
    $w('#button4').onClick((event)=>{
      console.log(event.target.id);
	  $w('#button4').disable();
       let toInsert = {
          propAvailabilityDate: data._id,
          member: wixUsers.currentUser.id,
          availabilityDate: data.weekAvailable,
          property: data.property._id
      }

  wixData.insert("BookingemailClicks", toInsert).then(()=> {
      let date = sortDate(data.weekAvailable);
      wixLocation.to("mailto:" + data.property.bookingsEmail + "?subject=Booking " + data.property.title + " from " + date);
      $w('#button4').enable()
    });  
});

Normaly the button should work. Take a look into the CONSOLE.

Don’t use EXPORT-FUNCTIONS, they are tricky.
Instead use the shown CODE-STRUCTURE, this type of coding is more save & realible.

thanks will look into it