Skip to content

Commit

Permalink
ADD: import from dict example
Browse files Browse the repository at this point in the history
  • Loading branch information
desty2k committed Jun 25, 2021
1 parent e876683 commit ff72767
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions example/steam_example.py
@@ -0,0 +1,14 @@
import paker
import logging

MODULE = {"somemodule": {"type": "module", "code": "fun = lambda x: x**2"}}
logging.basicConfig(level=logging.NOTSET)

if __name__ == '__main__':
with paker.loads(MODULE) as loader:
# somemodule will be available only in this context
from somemodule import fun
assert fun(2), 4
assert fun(5), 25
print("6**2 is {}".format(fun(6)))
print("It works!")

0 comments on commit ff72767

Please sign in to comment.