Sign in to follow this  

Python Module Import Question

Recommended Posts

I have several years of programming experience, but I have been learning python recently and I'm having trouble understanding its import behavior. I've got a project with a namespace tree, and I've got a test file that I'm importing modules from the project into. Something like this: "import as thing." Well, some/cool/ then tries to import a local module some/cool/ using "import anotherthing" This fails with a "No module named anotherthing" error. It does not fail, however when I use "import" So basically it wants the fully qualified namespace path.

I didn't write the code, and there are dozens of imports like this that are done locally. Is there some setting I need to change to make python look in the local directory of the module that's doing the import? It seems like I shouldn't have to use the full namespace name for everything.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this