Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:07:14+00:00 2026-06-12T05:07:14+00:00

>>> from foo.bar import app Traceback (most recent call last): File <stdin>, line 1,

  • 0
>>> from foo.bar import app
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named foo.bar

My directory structure:

In /foo:
    __init__.py
    bar.py

In /foo/tests:
    __init__.py
    testing.py

In /foo/tests/testing.py I need to import app from /foo/bar.py. I get the ImportError if I run the testing.py file.

I have checked sys.path and the /foo and /foo/tests folders are included.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:07:15+00:00Added an answer on June 12, 2026 at 5:07 am

    If /foo is on sys.path, then you can import bar using import bar, so try changing the import line in testing.py to the following:

    from bar import app
    

    Alternatively, put the root folder on sys.path, which will allow you to import the module foo and its contents using import foo.XXX, from foo import XXX, or from foo.XXX import YYY.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

two py file: ./src/foo.py def bar (): print 'bar!' ./tests/testfoo.py from foo import bar
from operator import itemgetter from itertools import takewhile xs = [ ('foo',1), ('bar',1), ('baz',2)
Say I have the following code in code.py: from foo import bar from foo2
Sample code: from BeautifulSoup import BeautifulSoup, SoupStrainer html='''<tr> <td align=left>Foo<br /> Bar<br /></td> </tr>'''
I have two namespaces: 1) Foo.Bar 2) Another.Foo.Bar From a class in namespace 2,
Suppose I have a class Baz that inherits from classes Foo and Bar ,
How is <None Include=C:\foo.bar /> different from <Content Include=C:\foo.bar /> ?
From the node repl: foo = { bar: 'baz'}; console.log (Object.getOwnPropertyDescriptor(foo, 'bar')) Returned value:
How do I remove the key 'bar' from an array foo so that 'bar'
Consider the following code from index view: <td> <%= 'foo' if bar == BAZ

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.