Can not call the Custom Widget from the Button


:game_die: 4, 2


Plus, you can use him to keep topics open :grin: (they normally close after about a month)


@discobot display help.


@discobot display help


I currently know how to do the following things:

@discobot start new user

Starts one of the following interactive narratives: new user, advanced user.

@discobot roll 2d6

:game_die: 3, 6

@discobot quote

:left_speech_bubble: Carry out a random act of kindness, with no expectation of reward, safe in the knowledge that one day someone might do the same for you — Princess Diana

@discobot fortune

:crystal_ball: You may rely on it




@Best_codes , are there any updates with fixing the bug with the CustomWidget in a button? As I see it still does not work. Thanks!


@Best_codes , even when I add just Button without CustomWidget it gives me the same error (when I click on that btm).


No, I have reported the bug, but it will probably be a while before it is fixed. :confused:


Until the bug is not fixed, here is my solution for those how may interested in:

In the Common code settings, in the “Add your JavaScript” find the button element that you have created and add the onclick listener. Note, that the elements loaded dynamically, so observe that. Also, the current state does not give you the ID of the button element, so I track the actual label like “Open Serial Monitor”. Here is the JS example:

var obsConfig = { childList: true, characterData: true, attributes: false, subtree: true };
var observer = new MutationObserver(function (m) {
    let collection = document.getElementsByClassName('blocklyFlyoutButton');
    for (let btn of collection) {
        if (btn.innerHTML.includes('Open Serial Monitor')) {
            btn.onclick = function () {
observer.observe(document.body, obsConfig);


This is great! I think you should make a new forum post about this, so users can use your solution and bookmark the post. Thanks for your contribution.