Problems in calling module function in Python? -
i have segmenting.py
module in package called processing
.
i trying call function in module in main. extremely simple.
in main.py
from processing import segmenting segmenting.test()
in segmenting.py
def test(): print 'succeed'
however, end errors follows:
>>> processing import segmenting >>> >>> segmenting.test() traceback (most recent call last): file "<stdin>", line 1, in <module> attributeerror: 'module' object has no attribute 'test' >>>
where went wrong?
the cause didn't restart interactive interpreter after editing (and saving!) segmenting.py
. modules imported once , cached. if edit source code , run import
statement again, module retrieved cache , doesn't pick changes. see reload()
built-in.
Comments
Post a Comment