Im learning about importing modules, following a tutorial, but a hit a wall. Whenever I open my IDLE, I try to import a file func.py into my shell by using
import func. The func.py file is in my C:\Python27\Scripts folder but it gets an error "no module named func". well, i open func.py using IDLE and hit f5(run) and then I can import it, or call the function in my func.py without importing it in the shell.
I'm not sure what i did differently before, but sometimes I have to use
func.functionInFunc(args)for it to work in my shell, after i have imported it(or sometimes after I ran the script) and other times all I have to do it call the function like
functionInFunc(args)and that works to.
I know I'm probably doing something wrong or different, just wondering what I have to do to be able to import, do I have to open my module every time and run it? And when do I have to put the modules name in front of the function when I want to call it, and when I don't have to. the tutorial does it both ways but doesn't explain why.

New Topic/Question
Reply


MultiQuote



|