boisgera
boisgera2w ago

RuntimeContext was already initialized.

Did anyone run into this error when using mo.Thread? Any clue about it?
3 Replies
Hall
Hall2w ago
Someone will reply to you shortly. In the meantime, this might help:
Myles Scolnick
do you have a minimal reproduction? i just tried it out and works for me:
import marimo

__generated_with = "0.9.25"
app = marimo.App()


@app.cell
def __():
import marimo as mo
return (mo,)


@app.cell
def __():
def foo():
print("hi")
return (foo,)


@app.cell
def __(foo, mo):
with mo.redirect_stdout():
mo.Thread(target=foo).start()
return


if __name__ == "__main__":
app.run()
import marimo

__generated_with = "0.9.25"
app = marimo.App()


@app.cell
def __():
import marimo as mo
return (mo,)


@app.cell
def __():
def foo():
print("hi")
return (foo,)


@app.cell
def __(foo, mo):
with mo.redirect_stdout():
mo.Thread(target=foo).start()
return


if __name__ == "__main__":
app.run()
boisgera
boisgeraOP7d ago
Ah, sorry, I did something stupid. Thanks for the reply and sorry for the noise! 🙏