Calling a method from invoking module
baskarans at gmail.com
Fri Oct 29 01:59:07 CEST 2010
I have two classes in separate python modules and I need to access some
methods of the either classes from the other. They are not in base and
derived class relationship.
Please see the example below. Foo imports Bar and inside the Foo class it
creates a Bar obj and then calls Bar.barz(). Now before returning control,
it has to call the track method in Foo.
As I understand, I won't be able to use 'super' in this case, as there is no
inheritance here. Also, I won't be able to move the track method to Bar as I
need to track different bar types.
Any suggestion on how to get this done would be great. Thanks in advance.
* foo.py *
print "Hello World"
b = Bar()
c = b.barz()
count += 1
* bar.py *
track_this = ...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list