[Python-ideas] Re: Making imports callable

2021-10-21 Thread Abdur-Rahmaan Janhangeer
Just amazing!!! Noted it down https://www.pythonkitchen.com/python-making-imports-callable/ Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius __

[Python-ideas] Re: Making imports callable

2021-10-21 Thread Chris Angelico
On Fri, Oct 22, 2021 at 3:49 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings list, > > Let's say i import module1 > > > import module1 > > can we do > > > module1() > > straight out of the box? > Yes! It takes a (very) little bit of work though. You have to replace your module's class with a sub

[Python-ideas] Re: Making imports callable

2021-10-21 Thread Abdur-Rahmaan Janhangeer
Sorry not if name == main, basically if module is being imported: __file__.callable = True Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius ___