Closed chenller closed 1 month ago
There is a setting "On module change":
Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by > module modifications as stale; if "autorun", affected cells will be automatically re-run.
What is your setting currently?
The function I expect is :
tools.py
, if I modify tools.py
, the imported module will not track the latest changes. It is "lazy". tools.py
, and then modify tools.py
. When I run the code that imports the module again, the latest changes to the module will be loaded.This means that morimo does not need to monitor module changes in real time, but only needs to re-import the module when I run the code to reload it. Marimo should not automatically reload modules before executing a unit of code. This behavior only occurs when encountering import xxx
code execution.
This is how "lazy" operates. You can enable that with the setting in the top-right dropdown menu.
The problem I encountered is:
The content of tools.py
is
def fun1():
print('fun1')
import tools
print(dir(tools))
Output is:
fun2
to tools.py
and save.
def fun1():
print('fun1')
def fun2():
print('fun2')
tools
variable did not import fun2
.
Can you copy your settings with: marimo config show
I have resolved this issue and thank you very much for your answer. Marimo is very user-friendly, and I will use it in future development.
I'm facing the same issue (marimo 0.6.25). I tried both auto_reload = "autorun"
and auto_reload = "lazy"
but neither sees the changes in the imported module.
Update: It seems that the issue was related to the VS Code extension. When I updated it, autoreloading started working just fine.
Describe the bug
If I create a file named
tools.py
, then I create a cell and run 'import tools', then I add a function totools.py
(such asdef fun1()
). Run the cell again, and the error 'AttributeError: module 'tools' has no attribute' fun1 'appears. It seems that Morimo cannot recognize the new changes in the filetools.py
. If I don't use Notebook and instead use Marimo, this bug will severely limit the application of MarimoEnvironment
marimo 0.6.13
Code to reproduce
cell1:
import tools
cell2:tools.fun1()