omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Does the order of def statements matter?

    Pythonista
    2
    2
    1418
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • themusicman
      themusicman last edited by

      Hi all

      I am writing a script using the animation/game template in Pythonista, and have written many functions that are called within the programme. Does the order the functions appear in the script matter?

      I am getting a name create_board' not defined error when running the script.

      The thing is, the function is actually there in the script. It is currently the first one listed under the MyScene class as here...

      class MyScene (Scene):
      	def create_board(self):
      		self.board = np.zeros((ROW_COUNT, COLUMN_COUNT))
      		return self.board
      

      And this function is called from within the def setup function further on down the script.

      Any pointers please? Sorry if this is a little vague, shout and I'll be happy to provide more detail if needed.

      Thanks
      John

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @themusicman last edited by

        @themusicman must be called as

        self.create_board()
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors