Skip to content Skip to sidebar Skip to footer

Python Global Dict Across Different File Script

Hello. I am trying to use a global dict created in main.py, which is called in functions.py. In my main.py I have: import sys,os,... import functions.py #import my second file mat

Solution 1:

In functions.py you would have to import it

frommain import matrix

Though I would want to come up with a better name for my module than main.

If you want an object to be available in a module / file you need to either create it there or import it from somewhere else.

Post a Comment for "Python Global Dict Across Different File Script"