The code within the file and in the forum is not the same.
The actual issue in your code posted on the forum is you are checking for if event_data['msg_id'] == 18: instead of if event_data['msg_data']['id'][1].id == 18:

Moreover, in the scene you attached which use my code, the button ID is set to 2.
So if you change if event_data['msg_id'] == 18: toif event_data['msg_id'] == 2: make it works.