I'm having difficulty accessing a variable.
I'm working toward the following, calling python script
from bash
, with arguments, which then imports a function defined in a second python script, executes it and thereby creates a variable which will be used later in the first python script.
At the moment,to test I'm copying and pasting directly into a Python terminal some commands like this:
from script2 import *
foofunction(arg)
print(newlist)
The foo function defined in script2
is executing, I can see files have been written but when I try to print the list supposedly created while executing the imported function, I get a message telling me it's undefined.
Inside my script2.py
, i made sure to enter a statement
global newlist
before defining its length and populating it.
I'm scratching my head at this stage.