Python Forum
Prefs class: singleton or something else?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prefs class: singleton or something else?
#1
I've got a singleton class I'm using that works pretty well but I have several other classes (in different .py files) so I have to create it in every one (Hence the singletopn). Problem is that the prefs class loads from disk and since I have several modules using it I end up loading the same things many times.

Is there a way I can declare just once and use that in imported classes or some way for me to check if the new prefs class is the first instance so I can only load at that time? Or is there something else I can use that would work better?

I have about 1 month of python experience so I'm quite the beginner.

Thanks
Reply


Messages In This Thread
Prefs class: singleton or something else? - by PatM - Dec-12-2022, 04:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  singleton using metaclass bb8 12 8,905 Feb-13-2018, 01:27 PM
Last Post: bb8

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020