help - Module needs access to another module

Discussion in 'Python' started by abcd, Mar 20, 2007.

  1. abcd

    abcd Guest

    I have the following directory/file structure...

    c:\foo\utils.py
    c:\foo\bar\ok.py

    In ok.py I want to do something like...

    import utils
    utils.helpMeDoSomething(....)

    However, it seems that ok.py doesn't "know" about utils. Other than
    manually configuring sys.path what can I do?

    thanks
     
    abcd, Mar 20, 2007
    #1
    1. Advertising

  2. abcd wrote:

    > I have the following directory/file structure...
    >
    > c:\foo\utils.py
    > c:\foo\bar\ok.py
    >
    > In ok.py I want to do something like...
    >
    > import utils
    > utils.helpMeDoSomething(....)
    >
    > However, it seems that ok.py doesn't "know" about utils. Other than
    > manually configuring sys.path what can I do?


    After a bunch of questions of that kind, I suggest you take a step back, and
    read this:

    http://docs.python.org/tut/node8.html

    Diez
     
    Diez B. Roggisch, Mar 20, 2007
    #2
    1. Advertising

  3. abcd

    abcd Guest

    On Mar 20, 9:58 am, "Diez B. Roggisch" <> wrote:
    > After a bunch of questions of that kind, I suggest you take a step back, and
    > read this:
    >
    > http://docs.python.org/tut/node8.html



    got it, thanks.
     
    abcd, Mar 20, 2007
    #3
  4. On Tue, 2007-03-20 at 06:46 -0700, abcd wrote:
    > I have the following directory/file structure...
    >
    > c:\foo\utils.py
    > c:\foo\bar\ok.py
    >
    > In ok.py I want to do something like...
    >
    > import utils
    > utils.helpMeDoSomething(....)
    >
    > However, it seems that ok.py doesn't "know" about utils. Other than
    > manually configuring sys.path what can I do?


    Why would you want to do something other than changing sys.path? Except
    for physically moving utils to somewhere that's already on the path,
    changing the path is cleanest way to handle this situation.

    -Carsten
     
    Carsten Haese, Mar 20, 2007
    #4
  5. abcd

    Ben Finney Guest

    "abcd" <> writes:

    > On Mar 20, 9:58 am, "Diez B. Roggisch" <> wrote:
    > > http://docs.python.org/tut/node8.html

    >
    > got it, thanks.


    Now that you've got that one part of the tutorial, please do *the
    whole thing*. Start from the beginning, run each example and watch
    what it does. Experiment with it until you understand what's going on,
    then move on. Repeat until done.

    You'll possibly see a bunch of things you have already learned, but
    you *will* cover a lot of gaps in your knowledge that you don't even
    know exist.

    --
    \ "People always ask me, 'Where were you when Kennedy was shot?' |
    `\ Well, I don't have an alibi." -- Emo Philips |
    _o__) |
    Ben Finney
     
    Ben Finney, Mar 20, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Collingwood

    Another newbie needs help

    Brian Collingwood, Apr 23, 2004, in forum: HTML
    Replies:
    2
    Views:
    352
    Whitecrest
    Apr 23, 2004
  2. plb
    Replies:
    0
    Views:
    400
  3. plb
    Replies:
    0
    Views:
    318
  4. Peter Olcott
    Replies:
    5
    Views:
    378
    Peter Olcott
    Dec 6, 2005
  5. Bart Van der Donck

    Own module needs loaded module from main script

    Bart Van der Donck, Aug 25, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    128
    Gunnar Hjalmarsson
    Aug 27, 2004
Loading...

Share This Page