.sub main @MAIN new_pad 0 # from scope2 import foo, f new P0, .pyModule set_addr P0, scope2 set I0, 0 # non-proto set I3, 0 # 0 arg invokecc P1 = P0["foo"] store_lex 0, "foo", P1 P0 = P0["f"] store_lex 0, "f", P0 # print f(), foo set I0, 0 # non-proto set I3, 0 # 0 arg pushbottomp # preserve P regs invokecc save P5 # result in P5 popbottomp restore P2 print P2 print " " find_lex P3, "foo" print P3 print "\n" # foo = 1 P5 = new PyInt P5 = 1 store_lex 0, "foo", P5 # print f(), foo set I0, 0 # non-proto set I3, 0 # 0 arg pushbottomp # preserve P regs invokecc save P5 # result in P5 popbottomp restore P2 print P2 print " " find_lex P3, "foo" print P3 print "\n" end # Module scope2 scope2: # foo = 2 P5 = new PyInt P5 = 2 store_lex 0, "foo", P5 # def f(): new P5, .pyFunc set_addr P5, f store_lex 0, "f", P5 invoke P1 # ret f: # return foo find_lex P5, "foo" set I0, 0 # non-proto set I3, 1 # 1 retval invoke P1 # ret .end