<br><br>
<div><span class="gmail_quote">On 9/22/07, <b class="gmail_sendername">Mridula Ramesh</b> <<a href="mailto:mridula.ccpl@gmail.com">mridula.ccpl@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hi.<br><br>i currently have code structured like this:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">classA():<br>    def __init__(): <br>     ..............<br>     ..............<br>    <br>    def fnc1():
<br>    ....................<br>    ....................<br><br><br>classB():<br>   def __init__():<br>    ........................<br>    ........................ <br>    classA.fnc1()    #this is where i get an error<br>
</blockquote><br>TypeError: unbound method fnc1() must be called with classA instance as first argument (got nothing instead)<br><br>when i do  fnc1(classA) i get: <br><br>NameError: global name 'fnc1' is not defined
<br><br>am i violating some programming rule by trying to call fnc1 in classB? i am only now learning OO alongside python, so i'm not sure! also, can someone please tell me where to go for more articles on the classes and functions and calling them from other places? 
<br><br>thanks a lot!<br><span class="sg"><br>mridula.<br></span><br>--<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list
</a><br></blockquote></div>
<div> </div>
<div>you should create an instance of ClassA:</div>
<div> </div>
<div>a = ClassA()</div>
<div>a.fnc1()</div>
<div> </div>
<div>or if you want a static function you should declare the method as static<br> </div>
<div>classA():<br>    def __init__(): <br>     ..............<br>     ..............<br>    @staticmethod<br>    def fnc1():<br>    ....................<br>    ....................<br clear="all">-- <br>Furkan Kuru </div>