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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -