0

I'm using python version 3.6.1

I want to use method of one python file to another located in a same directory. I have used from utils import wit_response in app.py file. And when I compile it this shows an error:

Traceback (most recent call last): File "app.py", line 4, in from utils import wit_response File "E:\Study\Python\fbmessengerbot\utils.py", line 1, in from wit import Wit ModuleNotFoundError: No module named 'wit'

In utils.py file I'm using from wit import Wit. The wit package i have already installed.

How can i resolve this.

Thanks in advance.

  • Does `python -c 'import wit; print(wit)' work? And what does it print? (Assuming you are using `python`, for instance without version suffix, for your other work) – languitar Jun 22 '17 at 07:22
  • @languitar it prints '' –  Jun 22 '17 at 07:27

1 Answers1

0

If you are using a Virtual environment do pip freeze and check whether "wit" package is installed or not. If "wit" is installed open ipython and check whether you can import the "wit" package. If "wit" is not imported in ipython check if any dependency packages are need for "wit".

Mallik Sai
  • 186
  • 1
  • 4
  • 16
  • yes wit is installed with status wit==4.2.0. And i have import wit in my utils.py file –  Jun 22 '17 at 07:39
  • And my utils.py file works fine but when i import it to app.py it will shows an error –  Jun 22 '17 at 07:42
  • @MashoodMurtaza try importing like this `from .utils import method_name ` – Mallik Sai Jun 22 '17 at 09:26
  • @MashoodMurtaza there is a answer which is similar to your question (https://stackoverflow.com/questions/43865291/import-function-from-a-file-in-the-same-folder?rq=1) – Mallik Sai Jun 22 '17 at 18:57