call function problem

how can i assign a private function to a public direct button?

DirectButton(text=ip, text_scale=0.05, command=###############, extraArgs=[arg], borderWidth = (0, 0))

class main(DirectObject.DirectObject):
def init(self):
def function(arg):

I’m not sure what you mean. Could you clarify what you’re trying to do?

i have a global function that created a list of button… when i clicked on one of this it would be call a private function… this function is in the init of the class main

Public/private works a bit different in Python (and it’s not really private, more like “less visible”). It’s mainly a naming convention:

class Foo:
  def public_func(self): pass
  def __private_func(self): pass

What you are talking about is a “local” or “inner” function:

class Foo:
  def outer(self):
    def inner(x): return x+1
    two = inner(1)

“Inner” functions exist only in the local namespace of the outer function. They are not accessible from outside the outer function.

thank you…