Unable to import python function in multifile usecase

Please take a moment to search the forum and documentation before posting a new topic.
If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed?

  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?
    b. Share the link to the public deployed app.

  3. Share the link to your app’s public GitHub repository (including a requirements file).

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

  5. Share the Streamlit and Python versions.

  6. App is deployed

  7. a. Community cloud b. https://or3gfhrqu8gtyrssq6dvde.streamlit.app/

  8. GitHub - NaveenH-tech/ML-2

  9. IndentationError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

    Traceback:

    File "/mount/src/ml-2/streamlit_app.py", line 14, in <module>
        from model.ml_core import build_preprocessor, get_models, compute_metrics
    
  10. Latest versions.

Hey there, thanks for sharing all the details and welcome to the community! :balloon: The error you’re seeing, IndentationError, means there’s a problem with the indentation (spacing/tabs) in your Python code—specifically in streamlit_app.py at or before line 14. This is a Python syntax issue, not specific to Streamlit, and will prevent your app from running until it’s fixed.

To resolve this, open streamlit_app.py in your repo, check for inconsistent indentation (mixing tabs and spaces, or misaligned blocks), and correct it. After fixing, commit and push your changes to GitHub—Streamlit Community Cloud will redeploy your app automatically. For more on debugging and best practices, see the Streamlit forum guide.

Sources: