Hi Venkata,
Thanks.
I could do this.
Import my first file as module and then using all  my methods
<modulename>.<methodname> format, but I would like to include my
<modulename> file and want to use just as <methodname> not as
<modulename>.<methodname>.
Hope I am clear.
Thanks,
Deepak

On Sat, Sep 6, 2008 at 5:45 AM, venkata subramanian <
[EMAIL PROTECTED]> wrote:

> Hi Deepak,
>  You can do this.
>  It is using the keyword called import.
>
>  The basic syntax is
> import <your_module_name_here>
>
>  example: import RegDesc
>
>  then, you can do RegDesc.foo(bar)
>
>  My friend had the same problem. He read the tutorial till
>  one point and missed the part where they talk about modules
>  and packages. So, go ahead and make sure you covered those topics.
>
>  Like other languages, your module should be in a 'path' called pythonpath.
>  you can do import sys and then type sys.path to know the path.
>
>  All the modules in your current directory can be imported (well,
>  without going into the nittie gritties of it).
>
>
>
> On Sat, Sep 6, 2008 at 8:03 AM, Deepak Patel <[EMAIL PROTECTED]>
> wrote:
> > Hello,
> >
> > I am new to Python and need some help.
> >
> > Can someone please tell me whether I can use the Python Module like
> include
> > file?
> >
> > Is there a way to use the "include" file in Python?
> >
> > If I try to include a file with "# include", that line is treated as
> > comment.
> >
> > What is the directive to include the include file in Python?
> >
> > I have created a Python prgram, say RegDesc.py for my registers class
> > definitions, for example, called as:class Reg:with all the register
> methods,
> > like ReadReg(), WriteReg() etc.
> >
> > In the same file, I have description of various registers, like:ConfigReg
> =
> > Reg(.....).
> >
> > Now I want to treat my RegDesc.py as include file to my other programs
> and
> > use the Reg class methods in my other programs.
> >
> > How can I do this? Do I need to use module?
> >
> > Thanks,
> > Deepak
> >
> >
> >
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers@python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to