title: Python 3 ModuleNotFoundError: No module named 'features'
body: <p>Im getting a ModuleNotFoundError: No module named 'features' when I import a page object model from a step python file. Im using python 3 MacBook.</p>
  
  <p>features/steps/tutorial.feature</p>
  
  <pre><code>import time
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as ec
  from selenium.webdriver.common.by import By
  from behave import *
  
  
  from features.lib.pages.login_page import LoginPage
  
  use_step_matcher("re")
  
  
  @given("user is lead to the login page")
  def step_impl(context):
      """
      :type context: behave.runner.Context
      """
      context.browser.get("https://www.phptravels.net/login")
  
  
  @when("I log in")
  def step_impl(context):
      """
      :type context: behave.runner.Context
      """
      page = LoginPage(context)
      page.login()
  </code></pre>
  
  <p>features/lib/pages/login_page.py</p>
  
  <pre><code>from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as ec
  
  
  class LoginPage:
      locator_dictionary = {
          "email_field": (By.NAME, 'username'),
          "password_field": (By.ID, 'password'),
          "login_button": (By.CSS_SELECTOR, '.btn.btn-action.btn-lg.btn-block.loginbtn'),
          "accept_cookies": (By.ID, 'cookyGotItBtn')
      }
  
      def __init__(self, context):
          self.browser = context.browser
  
      def login(self, username="xxxxx", passwd="xxxxx"):
          b = self.browser
  
          WebDriverWait(b, 10).until(
              ec.visibility_of_element_located((By.ID, "cookyGotItBtn"))).click()
  
          b.find_element_by_name('username').send_keys(username)
          b.find_element_by_id('password').send_keys(passwd)
          b.find_element_by_css_selector('.btn.btn-action.btn-lg.btn-block.loginbtn').click()
  </code></pre>
  
  <p>features/tutorial.feature</p>
  
  <pre><code>Feature: showing off behave
  
    Background: user is lead to the login page
      Given user is lead to the login page
  
    Scenario: login invalid
      When I log in
  </code></pre>
  
  <p>My directory structure is:</p>
  
  <pre><code>path = /Users/fran/PycharmProjects/prueba1
  path/features/tutorial.feature
  path/features/__init__.py
  path/features/lib/__init__.py
  path/features/lib/pages/__init__.py
  path/features/lib/pages/login_page.py
  path/features/steps/__init__.py
  path/features/steps/tutorial.py
  </code></pre>
  
  <p>Im getting this error</p>
  
  <pre><code>  File "steps/tutorial.py", line 10, in &lt;module&gt;
      from features.lib.pages.login_page import LoginPage
  ModuleNotFoundError: No module named 'features'
  </code></pre>
  
  <p>If I import it as </p>
  
  <pre><code>from ..lib.pages.login_page import LoginPage
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>  File "steps/tutorial.py", line 10, in &lt;module&gt;
      from ..lib.pages.login_page import LoginPage
  KeyError: "'__name__' not in globals"
  </code></pre>