• You want to use the global keyword inside your functions in order to allow your variable to be modified outside the defining scope.

    Actually you think you want globals,but usually they lead to grief, since it can be hard to debug -- for instance when you forget to declare global inside a function, you can read variables defined in external scope but not modify it. So it is easy to get confused.

    Consider using a class, then you can store things like that as class instance variables. Then it is never ambiguous which copy of the variable you are modifying.

  • @kastore , sorry for the delay to get back to you. I did see your post but forgot to get back to it because I dont check this area as much.
    But sorry, I cant be much help. Your code posted seems to work fine on my iPad Pro. I am still on the latestet Pythonista beta and iOS 11.2.1
    Are you on the beta or on the new release from the App Store? If you changed did it fix your problem? If it didn't what is your device? I have some other devices I could try

Internal error.

Oops! Looks like something went wrong!