Can't call Guy from a module when is stored in a module
Opened this issue · 0 comments
latot commented
Hi hi, I have this very weird thing..., actually I'm trying to store guy in other module to execute actions, but sadly didn't works:
#!/usr/bin/env python
from guy import Guy
class mod:
def __init__(self, gguy):
self.gguy = gguy
async def run(self):
await self.gguy.js.setEl("hahahah", "hihi")
await self.gguy.js.prompt()
class App(Guy):
def __init__(self):
Guy.__init__(self)
self.mod = mod(self)
async def mm(self):
await self.mod.run()
if __name__ == "__main__":
App().serve(open=False, autoreload=False)
<script src="guy.js"></script>
<body style="display:'none'">
<button onclick="self.mm()">Test</button>
<span id="hahahah"></span>
<script>
async function setEl(id, inner){
document.getElementById(id).innerHTML = inner
}
async function start(){
document.body.style.display = ""
}
window.setEl = setEl
guy.init(start)
</script>
</body>
Maybe there is a special thing to do or how to call guy?
What is weird, If i execute the same of the module in the main module it works, but why we can't execute guy in this way?
Thx.