Linked Questions

11 questions linked to/from python using variables from another file
29 votes
7 answers
127k views

I have script1.py which calls script2.py (subprocess.call([sys.executable, "script2.py"]). But script2.py needs variable x that is known in script1.py. I tried a very simple import x from script1, but ...
Z77's user avatar
  • 1,163
1 vote
5 answers
2k views

I have many python files all with the same variable names but different values. Something like this would be in one: var_one = 'happy' var_two = '2345' var_three = '-24.24' var_four = 'Chocolate' I ...
0 votes
1 answer
104 views

I'm fairly new to Python. Here's the code in 'file1' phrases = [] buildWord = "" file = open("words.txt") words = file.read() for i in words: if(i == "\n"): phrases.append(buildWord) ...
awoldt's user avatar
  • 429
0 votes
2 answers
83 views

I have created two files. The first one called EA contains variables and calls to functions. The second file called EA_Functions contains all the functions used in EA. This is EA: from EA_Functions ...
-4 votes
1 answer
829 views

I have a situation where if len(a) = 0 a = '' if len(b) = 0 b = '' if len(c) = 0 c = '' If len( any object) is zero , declare it as null. I have to keep doing this for all the alphabets . ...
-1 votes
2 answers
125 views

in python I have this set of variable variable.py #--------------Project 1--------------# ip_server = '10.10.55.98' username = 'user_1' distro = 'debian' #--------------Project 2--------------# ...
Bender's user avatar
  • 69
-1 votes
1 answer
196 views

I'm having some problems with this: I have two files: random and random2 random has this: import random2 print(random2.verb_list) print(random2.x) random2 has this: verb_list = ['x'...
luistripa's user avatar
0 votes
1 answer
155 views

I have a question, I have 4 file app.py, face.py, camera.py and db.py Inside face.py file I have one variable call known_encoding_faces. If I put print code inside my face.py and run the app.py the ...
user avatar
0 votes
2 answers
225 views

I have two files (Backupfile.py and Backupfile2.py). Following is in Backupfile.py: class Mater: def __init__(self): self.func() def func(self): from Backupfile2 import klasse ...
Soda's user avatar
  • 89
0 votes
2 answers
104 views

I have a two python files I am working with. In cryp.py I have: def test(): test = raw_input("> ") In cryptek.py I have: import cryp What is your name? cryp.test print "To be sure your ...
-1 votes
1 answer
58 views

Let's say I have a module that can open a website a module is like this: open("here is the variable from another python file") so how can I include that variable to my module I know there is ...
ZeroX's user avatar
  • 49