<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-html" lang="x-western"> Actually, the parethesis
mean "calling" the object.<br>
<br>
"Callable" objects can be of different types :<br>
-functions - in which case they get executed<br>
-classes (or metaclasses) - in which case they get "instantiated" (with
all the protocol : __new__(), __init__()...)<br>
-other objects - in which case they must contain a __call__ method with
will be executed when we use the parenthesis operator on the object.<br>
<br>
But a module is none of these : when you write "mymodule()", python
doesn't have a clue what he must execute/instantiate.<br>
<br>
Moduels aren't callable, but they can be "imported", simply by doing
"import mymodule", or "import mypackage.mymodule"<br>
Note that when you use packages, the modules that the package really
contains are searched with a protocol that can be rather elaborate, at
least (if I remember) the submodule name must be in the __all__
attribute of the package (i.e, the __all__ array defiend in the package
__init__.py file).<br>
<br>
I hope I haven't made you more confused with these quick explanations :p<br>
<br>
<br>
Regards, <br>
pascal<br>
<br>
Dale Amon a écrit :
<blockquote cite="mid:20090429193621.GO32190@vnl.com" type="cite">
  <pre wrap="">I am trying to get to the heart of what it is I am
missing. Is it the case that if you have a module C in a 
package A:

        A.C

that there is no way to load it such that you can use:

        x = A.C()

in your code? This is just a simpler case of what I'm
trying to do now, which has a module C in a sub-package
to be imported:

        A.B.C

ie with files:
        mydir/A/B/C.py
        mydir/mymain.py

and executed in mymain.py as:

        x = A.B.C()

I may still chose to do it the way you suggested, but I
would still like to understand why this does not work.

  </pre>
  <pre wrap=""><hr size="4" width="90%">
--
<a class="moz-txt-link-freetext"
 href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a>
  </pre>
</blockquote>
<br>
</div>
</body>
</html>