[Python] Global variables inside a local library [closed]

Discussão em 'Python' iniciado por Stack, Setembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to learn how to define a global variable inside a function that is located in my locally created library.

    I am working on a project of mine and I came up with a problem. I am trying to progress my counter variable by using a global variable inside my function, it has worked totally fine (while all my functions were defined inside my main program) until I have created my own library and transferred my functions there.

    Right now it approaches the function, runs it, but gives the following error:

    NameError: name 'StepCounter' is not defined


    (StepCounter is defined inside the main program. it is defined as a global variable inside the function.)

    Continue reading...

Compartilhe esta Página