Import does not work - ModuleNotFoundError: No module named 'menu'

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed?
    Running the app on Codespaces

  2. Share the full text of the error message (not a screenshot).

Traceback:
File "/home/vscode/.local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "/workspaces/racerecordmaster/main.py", line 5, in <module>
    from menu import menu, menu_with_redirect
  1. Share the Streamlit and Python versions.
    Streamlit 1.31.1
    Python 3.11.6 64-bit

I have followed the documentation here (Create custom navigation menus - Streamlit Docs) however, most of the time the import does not work. Thank you very much for your help

Did you create the menu.py file in the same path as main.py?

1 Like

Yes, I did. Both of them are in the directory that the init.py is located

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.