0

I need to import my module foo.py if I've got an absolute path (so module is located in "users/suv/desktop/pr1/pyth" but can be located in any different path as well) . I tried

  import sys

  MYDIR = "users/suv/desktop/pr1/pyth"
  sys.path.append(MYDIR)
  import foo

and I have the following mistake:

Traceback (most recent call last):
  File "./stats", line 7, in <module>
  import foo
ImportError: No module named foo

So what am I doing wrong?

Cheers

Max_S
  • 135
  • 1
  • 1
  • 9

1 Answers1

0
# Afile.py
import sys
sys.path.insert(0, '/path/to/application/app/DIRECTORY')

import Afile
Amjad
  • 3,110
  • 2
  • 20
  • 19