Get help from the marimo community

Updated 5 months ago

private imports inside one cell

At a glance
I tried to do such code

Plain Text
import subprocess as _subprocess
import os as _os

def open_symbol_location(symbol):
    location = get_symbol_location(symbol)
    _subprocess.Popen(
            ["code", location],
            preexec_fn=_os.setsid,
            stdout=_subprocess.DEVNULL,
            stderr=_subprocess.DEVNULL
        )


i.e. basically import modules as private variables just for a single cell

when I am using such function in another cell - I am getting error

Obviously it's not a big deal but could be useful situationally
but I don't know if it's a bug or more like explicitly unsupported thing?
Attachment
image.png
A
2 comments
I think that's a bug. Even this doesn't work. Looks like there's an edge case related to imports we don't handle
Attachment
image.png
Put up a fix. Thanks for reporting!
Add a reply
Sign up and join the conversation on Discord