I am programming a program with addon support. Addons are simple python scripts to import them.
import addon1
import addon2
import addon3
myvar = "hello"
def myfunc():
return "Python is great"
class myclass:
def __init__(self):
self.message = "Stackoverflow is great"
Now I want to access all the variables from my program in add-ons (for example, addon1)
So, I want to call an addon with my program as a parameter (like self in classes)
addon1.i_call_you(__program_self__)
So I'm looking for something similar to self in classes for complete python programs.
PS: For understanding:
addon1.py
def i_call_you(prog):
print(prog.myvar)
prog.myfunc()
source
share