# Show panel, only when a collection is loaded

How to show a panel, only when a particular collection exist (or appended)?

Here a bit more explanation of what I am aiming for in case the question is not clear:

In the screenshot above you see there is a panel called 3point light Ctrl. What I want is that the panel "3Point Light Ctrl" only shows up after the user clicked on "Add 3 Point Light" in the "Add to scene" panel.

Often I see a poll function in other addons like:

@classmethod
def poll(cls, context):
return context.active_object is not None


And so I thought I could do it as follows:

@classmethod
def poll(cls, context):
return return bpy.data.collections[“ThreePointLight”]


But that doesn't work, and I realize it is expecting context, not bpy.data. Any idea how I can do this? (It's for Blender 2.80).

You are going to want to use python's membership operator: in
@classmethod

Using bpy.data.collections[*name string*] would result in an KeyError in the event the name does not exist.
• Would be a KeyError if the name doesn't exist. Could also use collection.get(key) is not None – batFINGER Apr 23 at 9:25