I am a lover of rank in python, I am sure that there is a simple solution for this. I am trying to call a module that uses the os.path.exists function. If I write something like below, the code works fine.
import os if os.path.exists('text.txt'): print 'yes'
However, I get this error: "NameError: the global name" os "is not defined" when I call the module as shown below -
import os import modutest modutest.test()
with this module (I called it modutest.py)
def test(): if os.path.exists('text.txt'): print 'yes'
etsu source share