I am unable to access any object-defined variables, such as a varible like this:
self.code.append("hello world!")
Link: PyMash
I am unable to access any object-defined variables, such as a varible like this:
self.code.append("hello world!")
Link: PyMash
Hello.
When using objects, be sure to instantiate the object from the class before using the variable.
# wrong
thing = dict
thing.update({1: 1})
# right
thing = dict()
thing.update({1: 1})
What would I change to make self.code = []
usable from other functions within the object?
Right now, the problem is in your main.py
file. Your actual class is fine.
main.py
import pymash
site = pymash.html # wrong: should be 'site = pymash.html()'
site.add_line("h1","hello world")
I would recommend changing your class name to better fit with naming conventions, from html
to HTML
.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.