----- Original Message ----- > From: "Jean-Michel Pichavant" <jeanmic...@sequans.com> > To: "Juan Christian" <juan0christ...@gmail.com> > Cc: "Python" <python-list@python.org> > Sent: Monday, 22 September, 2014 1:37:41 PM > Subject: Re: Class Inheritance from different module > > > > class User(Inheritance from API): > > def __init__(self, ID): > > steamapi.core.APIConnection(api_key = KEY) > > super( " Inheritance SteamUser" (ID)) # creates the user using the > > API > > > > > > [...] > > > > > > So that in my code when I need to create a new user, I just call > > 'usr > > = User("XXXXXXX")' instead of calling 'usr = > > steamapi.user.SteamUser(76561197996416028)', is that possible? > [snip
Sorry, sent the message by mistake. Anyway if you just want a nice way to create an instance, you may simply write import steamapi.user.SteamUser as User usr = User('whatever') However you don't create an APIConnection when creating a user, it does not make much sense, you only need one API connection per session and it will be shared by all the User objects. # Note ApiConnection is a singleton, and you only need to execute this once, in you app/script initialization for instance. api = APIConnection(api_key='dlkfnsdlfn') # query the database user1 = User('user1') user2 = User('user2') Cheers, JM NB: I assumed you were using https://github.com/smiley/steamapi NB2 : because APIConnection is a singleton, your original code probably works just fine, I'm just not a big fan of breaking to python module design -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list