PyDev PYTHONPATH does not work for separate test und src directories
Question: This is probably a noob problem. For that I apologize, but I couldn't find a
solution so far. I short, for some reason that I don't understand, I can't
access modules from my `src` directory in my tests. My project setup looks
like this:

    
    
    src/package/module.py
    tests/package/module_test.py
    

and my test roughly looks like this:

    
    
    import package
    import unittest
    class module_test(TestCase):
       def testSomeMethod(self):
           m = package.SomeClass() #there is class of that name in module.py
    

I checked the run configuration setup in PyDev and it says that both `src` and
`tests` are on the PYTHONPATH when I execute the tests. But when I try to run
this test, I get the error `'module' object has no attribute 'SomeClass'`.

What am I doing wrong?


Answer: When you do `import package`, you import the package, not the module inside
it. If you want to import the module, you need to do `from package import
module` (and then refer to the class as `module.SomeClass`, not
`package.SomeClass`).

Packages are containers for groups of modules. They don't magically allow you
to access everything inside any of the modules (although you can have them
automatically import their modules). You still have to import the individual
modules in the package.

