I have three file .py. Main.py, one_file.py, second_file.py.
In one_file.py, I have a class named Create.
In the main.py I have something like this:
import one_file
var = input("yes or no?")
if var == "yes":
Create()
But I receive this error NameError: name 'Create' is not defined.
I also tried with from one_file import Create and from . import one_file
but it does not work anyway.
Code in one_file.py:
import random
class Create:
def __init__(self):
self.word()
def word(self):
word_list = ["hello", "word", "sun", "moon"]
print("This is your word")
print(random.choice(word_list))