title: NameError: name 'text' is not defined when importing new function named 'text'
body: <pre><code>Traceback (most recent call last):
    File "C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\ch6\analyze.py", line 46, in &lt;module&gt;
      words = text.split()
  NameError: name 'text' is not defined
  </code></pre>
  
  <p>I have gone over my code to make sure I input it just as the book I am following states. I am working my way through Head First Learn to Code. Everything appears to be as it should be. I am at a loss why my code keeps throwing this error.</p>
  
  <pre><code>import ch1text
  
  def count_syllables(words):
      count = 0
  
      for word in words:
          word_count = count_syllables_in_word(word)
          count = count + word_count
  
      return count
  
  def count_syllables_in_word(word):
      count = 0
  
      if len(word) &lt;= 3:
          return 1
  
      vowels = "aeiouAEIOU"
      prev_char_was_vowel = False
  
      for char in word:
          if char in vowels:
              if not prev_char_was_vowel:
                  count = count + 1
              prev_char_was_vowel = True
          else:
              prev_char_was_vowel = False
  
      return count
  
  def count_sentences(text):
      count = 0
  
      for char in text:
          if char == '.' or char == ';' or char == '?' or char == '!':
              count = count + 1
  
          return count
  
  def compute_readability(text):
      total_words = 0
      total_sentences = 0
      total_syllables = 0
      score = 0
  
  words = text.split()
  total_words = len(words)
  total_sentences = count_sentences(text)
  total_syllables = count_syllables(words)
  
  print(total_words, 'words')
  print(total_sentences, 'sentences')
  print(total_syllables, 'syllables')
  
  compute_readability(ch1text.text)
  </code></pre>
  
  <p>There is also a text file that was first a ch1text.txt file and I was told to open it in Python then save it as ch1text.py before importing it in Python. When I run the ch1text.py file it does run the text. What I am expecting is the other code to read through the text I imported and tell me how many words, sentences, and syllables are in the ch1text.py. Instead I get the error saying text isn't defined. Please help me. I have spent way too long trying to figure it out on my own and don't feel like I can move forward until I understand where I am going wrong.</p>
  
  <p>*Edited with proper indentation to reflect what I have in my py document.</p>