KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I seem to have run into a really confusing error. Despite importing the .py file containing my class, Python is insistent that the class doesn't actually exist. Class definition in testmodule.py: class Greeter: def __init__(self, arg1=None): self.text = arg1 def say_hi(self): return self.text main.py: #!/usr/bin/python import testmodule sayinghi = Greeter("hello world!") print(sayinghi.say_hi()) I have a theory that the import is not working as it should. How do I do this correctly?
Tags (comma-separated)
Save Edits
Cancel