0

Using iPython inside a virtual env (python 2.7.13 and iPython 0.31.1) I am trying to test some code that I have written inside a directory as follows.

Root 
  Dir1
   Dir2
     NeedsTesting.py
  Dir3
   Dir4
    Dependency1.py

Inside of NeedsTesting.py there is an import for Dependency1. When I am inside the Dir2 directory and try to import NeedsTesting I get the following error. ImportError: No module named Dependency1.

When I got back up to root and try import NeedsTesting.py the error ImportError: No Module named NeedsTesting.py.

When I try and call the file like from Dir1/Dir2 import NeedsTesting.py I get a syntax error pointing to the first / in the line.

How can I make it so iPython can find modules within an entire project, not just the immediate level?

DjangoBlockchain
  • 534
  • 2
  • 17
  • 1
    Possible duplicate of [Expand Python Search Path to Other Source](https://stackoverflow.com/questions/3144089/expand-python-search-path-to-other-source) – Joseph K. Nov 08 '17 at 17:44

1 Answers1

1

Does this help? We need to tell Python which directories to search for modules in.