Results 1 to 2 of 2

Thread: [Python] Importing a module

Threaded View

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [Python] Importing a module

    I can't find any examples of this in my book. And I am at the moment searching the web. But if anyone knows, how do I import a "module" (file) with my own usefull functions. Something like this didn't work:


    main.py:
    Code:
    import myModule
    
    
    print "Trying to call a function in the other file"
    myFunk()

    myModule.py:
    Code:
    def myFunk():
        print "It worked"


    It says that it can't find the function. Both files are in the same folder. Do I have to write some code to make it a module or something? Or is there a keyword that I have to use to make the function public or something?

    What am I missing here?



    ØØ
    Last edited by NoteMe; May 17th, 2005 at 05:06 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width