I have small a python script looking something like this:
def number1():
x = 1
open_numbers = []
open_numbers.append(x)
return open_numbers
def myfunction(open_numbers):
y = 1
open_numbers.append(y)
I would like to call the myfunction in the the end of the script. Using
myfunction()
But it keeps telling me missing 1 required positional argument: 'open_numbers'
Tried passing the argument and got name 'open_numbers' is not defined
I plan to add more functions later and run them the same way
function(arg)
function2(arg)
function3(arg)
myfunction?open_numbersonly exists inside ofnumber1. You need to use the return from that function if you want to use it.myfunction()without any arguments, you'll get the first error:1 required positional argument: 'open_numbers'. If you call it with the argumentopen_numbers, you need to defineopen_numbersout of the scope of the function or define it as a new local variable inside the functionmyfunctionwithopen_numbers, and the full error message with traceback. See How to Ask for more tips.