is there a way to share a single instance of an object without cluttering interfaces?

Either uses H as global

def __init__( self ):
    global H
    if H == None:
        ...

or pass it as argument of the init method:

def __init__( self, H ):
    ...

you can also make H a variable from your class:

class MyObject():
    H = None
    def __init__( self ):
        if MyObject.H == None:
           ...

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top