While generating code for custom blocks in blockly, i am getting error
Error: Language "Python" does not know how to generate code for block type "import_block".
when logging in console.
Following is the code for block creation
Blockly.Blocks['import_block'] = {
init: function() {
this.appendDummyInput()
.appendField("import")
.appendField(new Blockly.FieldTextInput("default"), "import_name");
this.setOutput(true, null);
this.setColour(230);
this.setTooltip("");
this.setHelpUrl("");
}
};
The code generation code is
let code = (Blockly as any).Python.workspaceToCode(Blockly.mainWorkspace);
console.log(code);
The block is visible in UI. Also the code gets generated for default blocks present in blockly but shows error for custom blocks.
Can anyone help me with this