Jan-24-2020, 07:43 PM
I'm trying to call functions from my "functions.py" module to my "mainTest.py" module.
Here is basically what I write:
from functions import function1
list1 = function1() #function1() is set to return a list#
My problem is, that once I try importing anything from the functions module, it reads the entire module through. Is this how it's supposed to work?
The problem here is, that when it tries to read the entire module, it requires variables that are not yet set.
I would like to import a single function, and work my way from there, and not have the whole module read when I simply want to import a function from there.
Also, I'm guessing that if I run a function from another module, it won't automatically know the variables from the module I am using the function in?
I have started pythoning 3 days ago, so please speak simply if you suggest fixes. But just getting answers to these questions would be nice, and I can figure out the rest I'd imagine.
Thanks guys!
Here is basically what I write:
from functions import function1
list1 = function1() #function1() is set to return a list#
My problem is, that once I try importing anything from the functions module, it reads the entire module through. Is this how it's supposed to work?
The problem here is, that when it tries to read the entire module, it requires variables that are not yet set.
I would like to import a single function, and work my way from there, and not have the whole module read when I simply want to import a function from there.
Also, I'm guessing that if I run a function from another module, it won't automatically know the variables from the module I am using the function in?
I have started pythoning 3 days ago, so please speak simply if you suggest fixes. But just getting answers to these questions would be nice, and I can figure out the rest I'd imagine.
Thanks guys!