custom edits to curdoc html

When writting standalone html it is sometimes convenient to do some edits in the html itself to import specific js libraries for example or add custom javascript code at the end of the body’s script div; like just after document.addEventlistener. Would it be possible to have some tools to edit the html of the document rendered by curdoc?

what about a curdoc().CustomJS and curdoc().imports(type,src)

Or is there already a way to do this?

I was managing to do that by using a timeout callback and dummy widgets that I would hide, but there is a better way to do it.

I can just add it in the implementation of a dummy extension of any model.

Here I change the css of and and I add a ‘global’ js function “custom()” that can be called by any JS callback. Similarly I could append new css or js links to the head.
from import curdoc
from bokeh.plotting import figure
from bokeh.models import TextInput, CustomJS
from bokeh.layouts import widgetbox

entry = TextInput(title=‘Test’)

DumClass_code = “”"
import {TextInput,TextInputView} from “models/widgets/text_input”

custom_css = document.createElement(‘style’) = ‘mystyle’
custom_css.type = ‘text/css’
custom_css.innerHTML = ‘label { color: plum; font-weight:bold } input {width:50px}’
document.body.appendChild custom_css

custom_script = document.createElement(‘script’) = ‘myscript’
custom_script.type = ‘text/javascript’
custom_script.innerHTML = ‘’’
function custom(){
document.body.appendChild custom_script

export class NewTextInputView extends TextInputView

export class NewTextInput extends TextInput

class DumClass(TextInput):
implementation = DumClass_code