﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24889	Multi dotted path ImportError	Abdulaziz Alfoudari	nobody	"I have a hierarchy of apps with different nesting levels:


{{{
├── apps
│   ├── accounts
│   ├── core
│   ├── modules
│   │   ├── companies
│   │   └── products
}}}

I'm encountering a weird behavior where importing multi dotted apps is raising an `ImportError` exception:


{{{
Traceback (most recent call last):
  File ""./manage.py"", line 12, in <module>
    execute_from_command_line(sys.argv)
  File ""/home/aziz/projects/officeman/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 338, in execute_from_command_line
    utility.execute()
  File ""/home/aziz/projects/officeman/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 312, in execute
    django.setup()
  File ""/home/aziz/projects/officeman/local/lib/python2.7/site-packages/django/__init__.py"", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File ""/home/aziz/projects/officeman/local/lib/python2.7/site-packages/django/apps/registry.py"", line 108, in populate
    app_config.import_models(all_models)
  File ""/home/aziz/projects/officeman/local/lib/python2.7/site-packages/django/apps/config.py"", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File ""/usr/lib/python2.7/importlib/__init__.py"", line 37, in import_module
    __import__(name)
  File ""/home/aziz/projects/officeman/django/apps/accounts/models.py"", line 8, in <module>
    from apps.modules.companies.models import Company
ImportError: No module named modules.companies.models
}}}

Running python interpreter, I'm able to import all the different packages at all levels:


{{{
>>> from apps.modules import companies
>>> companies
<module 'apps.modules.companies' from 'apps/modules/companies/__init__.pyc'>
>>> 
>>> from apps import modules
>>> modules
<module 'apps.modules' from 'apps/modules/__init__.pyc'>
>>> 
>>> import apps
>>> apps
<module 'apps' from 'apps/__init__.pyc'>
}}}


The only reason I'm suspecting this to be a bug is the fact that python can import all the packages while Django can't. All apps imported fine in Django before I nested a group of them under `modules`."	Bug	closed	Core (Other)	1.8	Normal	worksforme	ImportError		Unreviewed	0	0	0	0	0	0
