Skip to content

On module change "autorun" with nested imports #6940

@mthiboust

Description

@mthiboust

Describe the bug

Not sure it is intended behavior or not, but it surprised me that some modules depending on a changed file were not automatically reloaded (using the autorun setting for on module change).

my_package:

### core.py ###
from . import constants

def f():
    return constants.A

### constants.py ###
A = 1

my_notebook (in another folder):

from my_package import core

core.f()

The autoreload works well if I directly change the core.py file. But if I change the constants.py file to A = 2 instead, the notebook is not updated. Is there a way to force the reload of every modules depending on a separate module that changed?

Will you submit a PR?

  • Yes

Environment

Details
{
  "marimo": "0.17.0",
  "editable": false,
  "location": "/home/circleci/project/.venv/lib/python3.12/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "6.14.0-111032-tuxedo",
  "Processor": "x86_64",
  "Python Version": "3.12.8",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "--",
    "Node": "v18.18.2"
  },
  "Dependencies": {
    "click": "8.2.1",
    "docutils": "0.22.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.8.2",
    "narwhals": "2.1.2",
    "packaging": "25.0",
    "psutil": "7.0.0",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.16.1",
    "pyyaml": "6.0.2",
    "starlette": "0.48.0",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.14.1",
    "uvicorn": "0.38.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "altair": "5.5.0",
    "anywidget": "0.9.18",
    "nbformat": "5.10.4",
    "pandas": "2.3.1",
    "pyarrow": "21.0.0",
    "loro": "1.8.1",
    "pytest": "8.4.1",
    "ruff": "0.12.9"
  },
  "Experimental Flags": {}
}

Code to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions