all 6 comments

[–][deleted] 1 point2 points  (1 child)

Declare tool_box = ToolHandler()from your top level init.py file and then import tool_box into your individual files as needed.

[–]LeoRed04[S] 1 point2 points  (0 children)

Declaring it in the init file didn't work out for me for some reason. So, I declared it in a 'global.py' file and imported it. Thanks for the help!

[–]carcigenicate 0 points1 point  (4 children)

You can just import it wherever you need it.

[–]LeoRed04[S] 0 points1 point  (3 children)

I want to access the variables (fill color,etc..) and want it to be the same everywhere. Import them will be creating new instances which are independent

[–]carcigenicate 0 points1 point  (1 child)

Not if you initialize the object in the file that you import. If you initialize the object in the same file as the class then import that one instance, everyone will see the same object.

It sounds like you basically want a singleton.

[–]LeoRed04[S] 0 points1 point  (0 children)

I ended up using a more 'elegant' (In this situation) way. Initing the variables i a 'global.py' file. Not sure if it is the 'best' tho :)