def render_code(self): python_editor = self.get('e1') html_editor = self.get('e2') #Remove old component classes for comp_cls in Register.reg: if comp_cls not in (CodeMirror, ResultComponent, ComponentEditor): Register.remove(comp_cls) python_code = python_editor.get_code() try: eval(python_code) except Exception as e: print("Error evaluating code ", e) # Init comp classes again (User must have registered its comps in the code) initialize_comps_classes() # Add new html with components in it result_comp = self.get('result') result_comp.remove_all() result_comp.add_html(html_editor.get_code())