Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I don't know how to phrase this question, but this is my main script:

from terminal_module.output import Terminal as term

vterm = term()

This is the terminal output module (in relative directory /terminal_module/

from voice_synthesis.tts import TTS

class Terminal:
    synth = TTS()
    print("INIT FINISHED")

This is the TTS module (in relative directory from /terminal_module/voice_synthesis/

import pyttsx3

class TTS:
    engine = None
    def __init__(self):
        self.engine = pyttsx3.init()
    def speak(self, text):

And if I run: = Works as it exists almost immediately with no error = Works as it outputs INIT and then INIT FINISHED and exits with no error = Fails with the following error:

Traceback (most recent call last):
  File "e:\0000_AI\GEN_1\ANNA\src\", line 9, in <module>
    from voice_terminal_module.voice_terminal import VoiceTerminal as VoiceTerminalModule
  File "e:\0000_AI\GEN_1\ANNA\src\voice_terminal_module\", line 2, in <module>
    from voice_synthesis_module_TEMP.tts import TTS
ModuleNotFoundError: No module named 'voice_synthesis_module_TEMP'

Why is this? I could probably implement the TTS class functionality into Terminal, but this project will be pretty big, so I would like to have as many classes as possible. Hope this makes sense, thanks!

What I have tried:

I have tried running each script independently and it all worked.
Updated 2-Feb-22 4:09am
Richard MacCutchan 1-Feb-22 10:18am    
Look at the error message: there is no module named 'voice_synthesis_module_TEMP'. And it even tells you which line of source code is trying to do the import.
CodeSie Programming 1-Feb-22 12:09pm    
Yes but the problem is it errors out at the from terminal_module.output thingy and if i simply go into the and comment out the importing of the TTS, it works
Richard MacCutchan 1-Feb-22 12:24pm    
Then you need to use the debugger to find out why this happens. It is not possible to do it from here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900