DirectEntry focusInCommand and focusOutCommand not working

Hello, I’m trying to check if the DirectEntry object is being selected to prevent camera movement, but using focusInCommand and focusOutCommand isn’t working to assign state variables to detect if it’s focused or not, any tips on what I might be doing wrong? It’s capable of showing the DirectEntry text.

from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectEntry import DirectEntry

class Program(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        self.search_bar = DirectEntry(pos = (-1, .25, .9),  text = "", scale=.06,
        initialText="", numLines = 1, focusInCommand= self.setSearchFocus(), focusOutCommand= self.setSearchOutFocus())

        # Main Update Loop
        self.taskMgr.add(self.update, 'main loop')

    def setSearchFocus(self):
        self.searchInFocus = 1
    def setSearchOutFocus(self):
        self.searchInFocus = 2

    def update(self, task):
        print("Search Bar Status = {}".format(self.searchInFocus)) # Always outputs 2, even while in focus
        print("Search Bar Text = {}".format(self.search_bar.get()) )
        return task.cont

example = Program()
example.run()

Remove the () after the names of the functions when passing them to the DirectEntry. Otherwise you’re calling the function and passing their return value (None) to the focusIn/focusOutCommand.