 <pre><code>self.printfunc = weakref.ref(printfunc)() </code></pre> <p>isn't actually using <code>weakref</code>s to solve your problem; the line is effectively a noop. You create a <code>weakref</code> with <code>weakref.ref(printfunc)</code>, but you follow it up with call parens, which converts back from <code>weakref</code> to a strong ref which you store (and the <code>weakref</code> object promptly disappears). Apparently it's not possible to store a <code>weakref</code> to the bound method itself (because the bound method is its own object created each time it's referenced on <code>self</code>, not a cached object whose lifetime is tied to <code>self</code>), so you have to get a bit hacky, unbinding the method so you can take a <code>weakref</code> on the object itself. Python 3.4 introduced <a href="https://docs.python.org/3/library/weakref.html#weakref.WeakMethod" rel="nofollow"><code>WeakMethod</code></a> to simplify this, but if you can't use that, then you're stuck doing it by hand.</p> <p>Try changing it to (on Python 2.7, and you must <code>import inspect</code>):</p> <pre><code># Must special case printfunc=None, since None is not weakref-able if printfunc is None: # Nothing provided self.printobjref = self.printfuncref = None elif inspect.ismethod(printfunc) and printfunc.im_self is not None: # Handling bound method self.printobjref = weakref.ref(printfunc.im_self) self.printfuncref = weakref.ref(printfunc.im_func) else: self.printobjref = None self.printfuncref = weakref.ref(printfunc) </code></pre> <p>and change <code>myprint</code> to:</p> <pre><code>def myprint(self,text): if self.printfuncref is not None: printfunc = self.printfuncref() if printfunc is None: self.printfuncref = self.printobjref = None # Ref died, so clear it to avoid rechecking later elif self.printobjref is not None: # Bound method not known to have disappeared printobj = self.printobjref() if printobj is not None: print ("ExtenalFUNC:%s" %text) # To call it instead of just saying you have it, do printfunc(printobj, text) return self.printobjref = self.printfuncref = None # Ref died, so clear it to avoid rechecking later else: print ("ExtenalFUNC:%s" %text) # To call it instead of just saying you have it, do printfunc(text) return print ("JustPrint:%s" %text) </code></pre> <p>Yeah, it's ugly. You could factor out the ugly if you like (borrowing <a href="https://hg.python.org/cpython/file/tip/Lib/weakref.py" rel="nofollow">the implementation of <code>WeakMethod</code> from Python 3.4's source code</a> would make sense, but names would have to change; <code>__self__</code> is <code>im_self</code> in Py2, <code>__func__</code> is <code>im_func</code>), but it's unpleasant even so. It's definitely not thread safe if the <code>weakref</code>s could actually go dark, since the checks and clears of the <code>weakref</code> members aren't protected.</p>