Forums

Different import statements needed local vs pythonanywhere

Hi all,

I made a flask app using Blueprints and sorted different views out in directories across the app-folder. The directory structure is like:

`app

--- viewer

--- zalen

--- auth

app.py`

When i want to import something in viewer i use

from app.viewer import Class

But pythonanywhere doesnt allow this kind of structure. They ask me to do it like this:

from . import Class

I want to make big changes and pull from git. But I dont want to adjust every import statement on my webapp. Does anyone have the solution for this?

Thanks in advance!

Python looks on your python path for modules. If your paths are laid out differently, then it will behave differently. See the theory section here https://help.pythonanywhere.com/pages/DebuggingImportError/ to gain an understanding of how Python finds the modules that you are importing.