Blender 2.8 Scripting for a simple button i was trying script a button in 2.8 i stared withe the templates UI panel

but i wanted to place in the top bar which error out if i change the layout
is there any way to place the button in the top bar?
Pre or Append to the header.

With all panels and headers in blender you can append or prepend a draw method to them.



Test script prepends a splash screen button to topbar

import bpy

def draw(self, context):
    self.layout.operator("wm.splash")

bpy.types.TOPBAR_HT_upper_bar.prepend(draw)


To find the class to "leach" onto, with developer extras on, right click and view source. With the naming convention, TOPBAR pretty self explanatory, HT it's a header type. Hence using autocomplete in python console is a way to find contenders