I’m looking for a way to move several python files in to a single file e.g.
Instead of two files
foobartest.py
from foo import * bar()
foo.py
def bar()
return 'foobar'
Doing something like this:
class foo():
def bar()
#insert some way to get the class into the namespace
bar()
Is there a way to get a locally defined class into the root namespace of the same script?
The reason is that I want to merge several files without having change all bar() calls to foo.bar() and still have it relatively obvious how they’re broken up for someone reading the code.
edit: In the interest of clarity, I was looking for a way to do it for all functions in the class as opposed to individually for each function. Like a way to do a wild import on a class.
sounds super hacky, but you can do something like