It seems that I have found some workaround or a solution. Haven't quite figured out yet why it necessarily works, but if anyone could explain that would be awesome. So I moved my variables that need to be global to their own function (since they need to use functions anyhow to obtain the correct value). After declaring their own global variables in their respective functions, it seems that I was then able to update my global variable properly. Here is what I did.
I posted right as you did so I didn't see your post before I had posted my own response. I cannot find a good source tutorial on how to properly use variables outside/with other functions. How would you use a variable globally without being global?
def FindVin(): global Vin Vin = str(CustomerIndex[int(float(LoadedSales['CC'][InxLoc]))][2])[-8:] return VinAnd the main Function before FindVin is called.
def Main(): CustomerSaleID = CustomerSaleOBJID() Vin = FindVin() FPnum = FindFPnum()
(Sep-28-2018, 04:31 PM)micseydel Wrote: Why are you using global variables? They're notoriously hard to debug, and often viewed as poor code architecture.
If I inherited that code and had to fix it, I'd start removing the global variables just to wrap my head around how things work. Have you tried removing them? We can potentially help you move away from them, but personally I wouldn't even try to debug them as-is.
I posted right as you did so I didn't see your post before I had posted my own response. I cannot find a good source tutorial on how to properly use variables outside/with other functions. How would you use a variable globally without being global?