title: How to use values from variables imported from another file python
body: <p>so I know this has been asked in several forms before, but I cannot relate to any of those, either I have something different or I just don't understand them. </p>
  
  <p>The problem is I have script A and script B, and in script A I calculate and have all the variables I want to use in script B.</p>
  
  <p>Script A has various functions, let's say for now I just want to pass a simple number from a variable in script A to script B , let's call the variable <code>value</code> .</p>
  
  <p>I used <code>from script_A import value</code> .</p>
  
  <p>Now, I have <code>value</code> initialized in script_A with 0 right at the top to say so, but script_A processes <code>value</code>, and gets a result clearly different from 0, but when I debug, I am getting in script_B <code>value == 0</code>, and not <code>value == calculated_value_that_should_be_there</code>.</p>
  
  <p>I did not know what to do so I tough about scope,so I put it in the <code>return</code> of a function, I tried making variable <code>value</code> a Global variable. Nothing seems to work in the way that I am not passing the calculated 'value' but I am passing to script_B that 0 initialization. </p>
  
  <p>P.S last thing I tried and what I saw from this topic is to import script_A as it was said with no namespaces. This has worked. When I write script_A.value it is calculated_value_that_should_be_there. But, I do not know why anything else that I described did not work.</p>
  
  <pre><code>script_A
  
  
  from definitions import *
  variable_1 = 0
  variable_2 = 0
  variable_3 = 0
  variable_4 = 0 
  
  total = 0
  respected = 0
  
  time_diff = {}
  seconds_all_writes = "write"
  
  class Detect():
      def __init__(self, data_manager, component_name, bus_name_list=None):
  
   def __Function_A(self):
         """
          global time_diff
          global seconds_all_writes
  
          process
  
  script_B:
  from script_A import respected
  from script_A import total
  
  
  import script_A
  
          print aln_mon_detector.total
          print aln_mon_detector.respected
  </code></pre>
  
  <p>I also want a dictionary</p>
  
  <p>table_content.append(script_A.time_diff[file[script_A.seconds_all_writes]) </p>
  
  <p>I get </p>
  
  <p>KeyError: 'writes'</p>