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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -