I've been programming in Python and ran into a problem that I think makes my code a lot more messy, and I'm trying to find a workaround. It's a large program, so instead of just dropping it here and making you sort through it I'll give a summary of my problem.
Basically, my program consists of 3 files.
The first, main.py, looks like this:
import util
import content
util.myfunc('unique parameters')
content.otherfunc()
The second, content.py, looks like this:
import util
def otherfunction()
util.myfunc('unique parameters')
What's happening is that I want to use the util module's functions in content and main.
The problem here is that, I have this messy problem where I can call all the stuff from util from content from main.
main.py:
import content
import util
content.util.myfunc()
but I don't want to have to do this because content is not related to util in the sense that it only imports it to use the functions. They do not have a shared purpose.
Also, this results in importing util twice.
I'm trying to get neater code and would like to find a solution WITHOUT importing util twice. Any ideas?
utilis only evaluated the first time it is imported.import utilit in all files which useutilin code - so stop bother this.