[BangPypers] Managing variable in small scripts.

Gora Mohanty gora at mimirtech.com
Wed Feb 19 11:18:50 CET 2014


On 19 February 2014 15:37, Mukesh Yadav <mak.gnu at gmail.com> wrote:
> Hi,
>    I normally create small scripts for crons, Sometime I do create multiple
> modules.
> My question is how to pass same variable to modules which is being used.
>
> e.g.
>
> script.py file contans following code
>
> *import module *
>
> *bucket* = 'some_bucket'
>
> object = module.*Class_name*('value');
>
> object.*some_awesome_function*()
>
> I want bucket variable should be available in *some_awesome_function. *
>
> How to achieve above?

Unless I am missing something, why can't you use:
  object.some_awesome_function( bucket )

It makes little sense to me to have a class import a
variable from a script just to use it in a function. Also,
as you are presumably writing these scripts after the
class code has already been created, how would the
class know where to import from?

Regards,
Gora


More information about the BangPypers mailing list