I have two .py files
lets say for the example that both files import sys
I want to import into
Helper.py like this: from helper.py import * (because I need all functions in it)
but I don’t want to remove from any of the files the import sys because these two files aren’t really go hand by hand.
is there a way to to import * and exclude the imports/from…import of another file?
You can define the
Helper.py file, add a line
__all__ = ["foo", "bar"] # All the objects you want to export
SomeClass.py just use
from helper.py import *, this will only import what is specified in
Answered By – Raida
Answer Checked By – Pedro (BugsFixing Volunteer)