Python not recognising another file -



Python not recognising another file -

i creating python module. test set file in same directory , wrote code

import mymodule mymodule.dofunction

python said >>>no module named mymodule in same directory.

adapting previous reply here. explicitly state want utilize current directory.

also, consider need "__init__.py" file in each directory importing from.

import os, sys lib_path = os.path.abspath('.') sys.path.append(lib_path) import mymodule

more info on import scheme here.

python

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -