how to run the "main" section of another module ?

S

Stef Mientki

hello,

when I''m working in a library,
and want to test some of the library functions,
I need to switch to a main application,
(which has a normal main-section)
and run that.

If the library is simply,
I add a main section to the library,
so no problem.

But if the library requires a lot of overhead,
I want to run some main program,
that has a main section,
and uses my library under construction.

So how do I call from within the library module,
in a main section in that library module,
a main in another module ?

thanks,
Stef Mientki
 
A

Aahz

when I''m working in a library, and want to test some of the library
functions, I need to switch to a main application, (which has a normal
main-section) and run that.

if __name__ == '__main__':
main()

Then you can call main() from another module for testing purposes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top