Modulenotfounderror: No Module Named 'Fire'

I am getting an error when I try to import a function from another python file in the same directory. When I remove the import the app runs fine. Can anyone tell my why I am getting the following import error?

I should add that i am running the app my running the start.sh file

start.sh

source venv/bin/activate
export FLASK_APP=myapp.py
flask run

ModuleNotFoundError: No module named 'fire'

routes.py

from flask import render_template
from app import app
from fire import fire

@app.route('/')
@app.route('/index')
def index():
    user = {'username': 'Miguelll'}
    posts = [
        {
            'author': {'username': 'John'},
            'body': 'Beautiful day in Portland!'
        },
        {
            'author': {'username': 'Susan'},
            'body': 'The Avengerss movie was so cool!'
        }
    ]
    print(fire())
    return render_template('index.html', title='Home', user=user, posts=posts)

fire.py

import pyrebase

config = {
  "apiKey": "SNIP",
  "authDomain": "SNIP.firebaseapp.com",
  "databaseURL": "SNIP",
  "storageBucket": "SNIP.appspot.com",
  "serviceAccount": "SNIP.json"
}

firebase = pyrebase.initialize_app(config)

def fire():
  auth = firebase.auth()
  #authenticate a user
  user = auth.sign_in_with_email_and_password("[email protected]", "SNIPSNIPSNIP$")

  all_agents = db.child("items").get(user['idToken']).val()

  print(all_agents)

My Directory structure(Why is this image so big ha):

1 Answer

I needed to change my import to

from app.fire import fire

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest