sion__`` attribute. Args: filename: a path-like object or a readable stream. If `None` (the default), read from a named file in a temporary directory. update: if `True`, initialize the dictionary with the current state of the module prior to loading the state stored at filename. **kwds: extra keyword arguments passed to :py:class:`Unpickler()` Raises: :py:exc:`UnpicklingError`: if unpickling fails Returns: A copy of the restored module's dictionary. Note: If ``update`` is True, the corresponding module may first be imported into the current namespace before the saved state is loaded from filename to the dictionary. Note that any module that is imported into the current namespace as a side-effect of using ``update`` will not be modified by loading the saved module in filename to a dictionary. Example: >>> import dill >>> alist = [1, 2, 3] >>> anum = 42 >>> dill.dump_module() >>> anum = 0 >>> new_var = 'spam' >>> main = dill.load_module_asdict() >>> main['__name__'], main['__session__'] ('__main__', '/tmp/session.pkl') >>> main is globals() # loaded objects don't reference globals False >>> main['alist'] == alist True >>> main['alist'] is alist # was saved by value False >>> main['anum'] == anum # changed after the session was saved False >>> new_var in main # would be True if the option 'update' was set False r.