Python script is not respecting updated numercal values

This simple test script fails to update the value for ddd. :grimacing:
Line 19 is not working.

An gues you declare ddd as a number (10) later ddd is a list???

Need the full sample code and an indication of your inputs, what Python engine you are using, and what you expect it to produce.

assign the OUT variable after the function call (at the end of main_fn)

before calling the function, in the global scope the OUT variable is indeed equal to 10

“Line 19 is not working” doesn’t really explain much.

Is it crashing?
Is it just doing nothing?
Is it making a cup of tea but you wanted coffee?

Also, you’ve got a function but you’re not returning anything…
Yes I know you’re trying to use global… but i’d suggest you try return.

def fn_a():
    global ddd
    ddd = (aaa - bbb)
    return ddd 

You’re also not checking that aaa and bbb are integers.
What if they’re a list? What if they’re characters? What if they are… well, you get the point.

Thanks for all the help. Revit python script outputting is little different than Vanilla Python 3. This was a proof of concept for a larger project. It works now.