[Zope] Re: How can I import python script into another python script?

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Fri Sep 1 05:12:41 EDT 2006


Gabriel Genellina wrote:

> At Thursday 31/8/2006 18:11, Ferhat Ayaz wrote:
> 
>>I have a Script (Python) called 'functions'.
>>I want to import this script into another Script
>>(Python).
>>
>>import Include.Functions.requests
>>
>>says
>>
>>import of "Include.Functions.requests" is unauthorized
> 
> You don't import it; you can reference it as 
> container.Include.Functions.whatever(args...)
> 

Or even do:

    Functions = container.Include.Functions

and then reference:

    Functions.whatever()

But do yourself a favour and extract the functions out of your Python 
script into a Python module. It will run faster and be easier to maintain 
and to debug.



More information about the Zope mailing list