How to import modules that are used in both the main code and a module correctly?
Posted
by Deniz
on Stack Overflow
See other posts from Stack Overflow
or by Deniz
Published on 2010-03-21T04:18:30Z
Indexed on
2010/03/21
4:21 UTC
Read the original article
Hit count: 486
Let's assume I have a main script, main.py, that imports another python file with 'import coolfunctions' and another: 'import chores'
Now, suppose coolfunctions also uses stuff from chores, hence I declare 'import chores' inside coolfunctions.
Since both main.py, and coolfunctions import chores ~ is this redundant? Is there any other way of doing this? Am I doing it correctly?
I'm confused about how python projects should be structured in general. I have a "conf.py" file, that I import for a bunch of variables ~ is this a module or not? I load this conf file in multiple places as well.
© Stack Overflow or respective owner