Sharing package data across files

Michael Selik michael.selik at gmail.com
Tue Jun 28 18:37:15 EDT 2016


On Tue, Jun 28, 2016 at 3:21 PM <scottpakin1 at gmail.com> wrote:

> I'm trying to create a package in which the constituent files share some
> state.  Apparently, I don't understand scopes, namespaces, and package
> semantics as well as I thought I did.  Here's the directory structure for a
> simplified example:
>
>    example/
>      __init__.py
>      vars.py
>      funcs.py
>
> How can I make the example package work like one integrated module even
> though in reality it's split across multiple files?
>

Why do you want to?
Isn't easier to have the ``funcs`` module import the ``vars`` module?
Even easier, paste all the code into a single file.



More information about the Python-list mailing list