Change Codemirror language

I am using Codemirror 6. I am having a problem with changing a language after the editor is mounted. Here is how I am mounting and attempting to change the language:

const languageConf = new Compartment()

const view = new EditorView({
      extensions: [
          basicSetup,
          EditorState.readOnly.of(this.readOnly),
          javascript()
      ],
      doc: "const a = 2",
      parent: element
    })

view.dispatch({
  effects: languageConf.reconfigure(python())
})

But there is no luck with it. Can anybody show me how to correctly update the language?

See the example for dynamic configuration.

I have seen this example before. I think I am doing the same thing in my case as well. But somehow, language is not updated.
@marijn