#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2017
    Location
    Los Angeles, CA
    Posts
    2
    Rep Power
    0

    Importing Modules in Python


    Hello there,

    I'm very new to all this. I'm wondering about how to save a file and import it in an IDE. Very
    basic question. My apologies and thanks.
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,888
    Rep Power
    509
    Create, with a text editor not with a word processor, a file of python code which you'd like to import into another python program.
    Save the file with an extension (file type) .py
    In the same directory create your program.
    In that file use

    import your_module
    #...
    your_module.your_function(your, arguments)


    Python has a bunch of choices to handle more complicated situations both in the structure and location of the module to be imported and in the name and access of the module where it is used.

    You could ask additional specific questions here or you could read the manual. https://docs.python.org
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2017
    Location
    Los Angeles, CA
    Posts
    2
    Rep Power
    0
    Ok. I'll give it a shot. Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo