<br clear="all">Are you missing an import?<br><br>import ohYeah<br>f = ohYeah.foo('wow')<br><div>...<br></div><div><br></div>~/santa<br>
<br><br><div class="gmail_quote">On Thu, Mar 3, 2011 at 5:45 PM, dude <span dir="ltr"><<a href="mailto:erniedude@gmail.com">erniedude@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've been struggling with getting my class to behave the way I want<br>
it.<br>
<br>
I have python module called ohYeah.py, defined as follows...<br>
#File Begin<br>
class foo:<br>
<br>
def __init__(self, arg1):<br>
print arg1<br>
self.ohYeah = arg1<br>
<br>
def whatwhat(self):<br>
return self.ohYeah<br>
#EOF<br>
<br>
My goal is to be able to instantiate the class foo from another python<br>
module, like so:<br>
<br>
# Example Usage<br>
f = foo("wow")<br>
j = foo("amazing")<br>
f.whatwhat()<br>
wow<br>
j.whatwhat()<br>
amazing<br>
#<br>
<br>
However, I always get the "module not callable" error. After entering<br>
a "def __call__" method in class foo, still get the same problem. Can<br>
someone please point me in the right direction for being able to<br>
achieve the Example Usage above? I'm sure there is something trivial<br>
I'm missing, but after digging around online for a day, I couldn't<br>
find the missing piece. Thanks in advance.<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>