Access a class in another python script

Terry Reedy tjreedy at udel.edu
Thu Oct 8 02:44:39 EDT 2015


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




More information about the Python-list mailing list