title: Cannot import from __init__ in a subfolder
body: <p>This is my folder structure:</p>
  
  <pre><code>storage/
      __init__.py - contains class StorageAbstract, class DummyStorage, class STORE_TYPE
      file.py - contains class FileStorage
      db/
          __init__.py - contains class DbStorage, class DbStorageAbstract 
          pg.py - contains class PgStorage
          sqlite.py - contains class SQLiteStorage
  </code></pre>
  
  <p>Classes PgStorage and SQLiteStorage inherit from DbStorageAbstract so I need to import it. I do it like this (in pg.py and sqlite.py) :</p>
  
  <pre><code>from . import DbStorageAbstract
  </code></pre>
  
  <p>And that throws the following error:</p>
  
  <pre><code>ImportError: cannot import name 'DbStorageAbstract'
  </code></pre>
  
  <p>However, when I move DbStorageAbstract from storage/db/__init__py. to storage/__init__py and import it like this:</p>
  
  <pre><code>from .. import DbStorageAbstract
  </code></pre>
  
  <p>then it works fine. I have read <a href="https://stackoverflow.com/questions/22187279/python-circular-importing?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">this</a>, <a href="https://stackoverflow.com/questions/582723/how-to-import-classes-defined-in-init-py?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">this</a> and many other resources but still can't figure out what is causing the problem. If it was circular dependence then moving the class to another file would not help I think.</p>
  
  <p>If there is any more information needed, let me know in the comments and I will edit the question.</p>
  
  <p>I am using Python 3.5</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Although this question has been identified as a possible duplicate of <a href="https://stackoverflow.com/questions/4142151/how-to-import-the-class-within-the-same-directory-or-sub-directory">this question</a> I don't see how it answers my question. Unlike the other question, I already have <strong>init</strong> files in each folder. If I am wrong please point me to where I can find the answer.</p>
  
  <p><strong>EDIT 2:</strong>
  This is the db/<strong>init</strong>.py file:</p>
  
  <pre><code>##################################################################
  # Copyright 2018 Open Source Geospatial Foundation and others    #
  # licensed under MIT, Please consult LICENSE.txt for details     #
  ##################################################################
  
  #import sys
  #sys.path.append("/mnt/c/Users/Jan/Documents/GitHub/pywps")
  
  import logging
  from abc import ABCMeta, abstractmethod
  from pywps import configuration as config
  from .. import StorageAbstract
  from . import sqlite
  from . import pg
  
  
  LOGGER = logging.getLogger('PYWPS')
  
  
  class DbStorageAbstract(StorageAbstract):
      """Database storage abstract class
      """
  
      __metaclass__ = ABCMeta
  
      @abstractmethod
      def store(self, output):
  
          pass
  
  
      @abstractmethod
      def store_output(self, file_name, identifier):
  
          pass
  
  
  class DbStorage(StorageAbstract):
  
      def __init__(self):
  
         self.storage = self.get_db_type()
  
  
      def store(self, output):
  
          assert(self.storage is not None)
          self.storage.store(output)
  
  
      def get_db_type(self):
          # get db_type from configuration 
          try:
              db_type = config.get_config_value('db', 'db_type')
          except KeyError:
              raise exception("Database type has not been specified")
  
          # create an instance of the appropriate class
          if db_type == "PG":
              storage = pg.PgStorage()
          elif db_type == "SQLITE":
              storage = sqlite.SQLiteStorage()
          else:
              raise exception("Unknown database type: '{}'".format(db_type))
  
          return storage
  </code></pre>