title: Trying to use a variable that is inside a function in another function
body: <p>So I am trying to use a variable that is inside a function in another function.</p>
  <p>One of them is the &quot;message.py&quot; file, that is in the folder &quot;properties&quot;. The file looks like this:</p>
  <pre><code>def nachricht():
      global msg
      msg = input(&quot;Type: &quot;)
      return msg
  </code></pre>
  <p>The other file is the &quot;badwords_check.py&quot;, that is in the folder &quot;module&quot;. This file looks like this:</p>
  <pre><code>from properties.message import msg
  from properties.badwords import BadWords
  
  def badwords_check():
    if any(word in msg for word in BadWords):
      print(&quot;Dont use that word!&quot;)
      
    else:
      print(&quot;Message send!&quot;)
  </code></pre>
  <p>The problem now, is that I can't import &quot;msg&quot; from &quot;message.py&quot;.</p>
  <p>The error code looks like this:</p>
  <pre><code>from properties.message import msg
  ImportError: cannot import name 'msg' from 'properties.message'
  </code></pre>
  <p>I had tried things like: Global, with/without function(without the function it works, but I need it with a function because some other code and files) and I tried return.</p>