Hook not working

Hi all

I am trying to create a hook for a custom button I have created using pyRevit.
Is this not possible?
I go the command ID by exporting a Revit shortcuts XML file as seen below, but when I load my extension into pyRevit, it returns an error stating that my hook is invalid.

#import Revit libraries
import clr
clr.AddReference('RevitAPI') 
clr.AddReference('RevitAPIUI') 
from Autodesk.Revit.DB import * 
from Autodesk.Revit.UI import *

# import libraries os and datetime
import os
from datetime import date, time, datetime

#import pyrevit libraries
from pyrevit import EXEC_PARAMS
from pyrevit import forms
from pyrevit.revit import files

app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document

#document name
docName = doc.PathName

#get current date and time
now = datetime.now()

#prevent the tool, await input
mip = forms.alert("Run the script?", options = ["Yes", "No"], title = "Worksets", footer = "pyRarch")

try:
    #workset script usage file path
    filepath = os.path.join(r'Z:\BPAS Staff INDEX\081 - Bayo\01_Design Technology\16_Audits\Script Usage', 'Worksets_Workset Script Usage.txt')

    # process the outcome
    if mip == "Yes":
        if not os.path.exists(r'Z:\BPAS Staff INDEX\081 - Bayo\01_Design Technology\16_Audits\Script Usage'):
            os.makedirs(r'Z:\BPAS Staff INDEX\081 - Bayo\01_Design Technology\16_Audits\Script Usage')
        file = open(filepath, "a")
        file.write("User= "+((os.environ.get('USERNAME')).lower()).capitalize()+" | File Path= "+docName+" | "+"Script Usage= Used the BPAS tab worksets tool | "+"Time= "+str(now)+"\n")
        EXEC_PARAMS.event_args.Cancel = False
    else:
        EXEC_PARAMS.event_args.Cancel = True
        
except:
    print("Heya please make sure you are connected to the network :D. Thank you!")