Search code examples
pythoncmdwlstpython-2.2

Failed to import python file from the same directory (version 2.2)



I have the following python files:
help_functions.py
check.py
I'm trying to import help_functions file from check file (both files in the same directory) with the following command:

from help_functions import Utils

after running it from cmd with WLST which has Python 2.2 interpreter I get the following error:
ImportError:no module named help_functions

any idea what should I do to make it recognize the help_functions file?


Solution

  • Short answer: add the scripts containing folder (full path, not relative) to your PYTHONPATH environment variable.

    Long answer: your scope is not what you think it is. See this answer for more details: ImportError: No module named... (basics?)