Access a class in another python script
DBS
davanand.bahall at gmail.com
Thu Oct 8 13:40:48 EDT 2015
On Wednesday, October 7, 2015 at 11:46:05 PM UTC-7, Terry Reedy wrote:
> On 10/8/2015 2:24 AM, DBS wrote:
> > I'm using Python 3.5 and have two python scripts where one needs
> > access to a class in the other script for authentication purposes.
>
> Any python .py file can be either run as a main program or module (ie,
> script) or imported as a module by another module. If a file is meant
> for both, it should end with
>
> if __name__ == '__main__:
> <what to do when running as main>
>
> The latter is ofter to call a function main() defined previously. If
> you have a problem with this, write a **minimal** example with at most
> 10 lines per file and post.
>
>
> --
> Terry Jan Reedy
Hello Terry,
Thanks. Will do and get back with what come up with. To clarify your repsonse, I need to change the file name to reflect __filename__.py and then import the needed components (classes and variables) accordingly?
More information about the Python-list
mailing list