Importing another project?

17 views
Skip to first unread message

Nick Gilmour

unread,
Dec 24, 2017, 2:19:37 PM12/24/17
to pyspider-users
Hi all,

I would like to have a base project which other projects can use. In the documentation is mentioned that it is possible to import another project as a module with:

from projects import other_project

but I can't figure out how to use. What's the idea behind this? What can be shared among projects?

Can anyone provide an example?


Regards,
Nick

Roy Binux

unread,
Dec 24, 2017, 2:36:03 PM12/24/17
to Nick Gilmour, pyspider-users

projectA:

def foo(a):
  return a*a

projectB:

from projects import projectA
projectA.foo(1)


--
You received this message because you are subscribed to the Google Groups "pyspider-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyspider-user...@googlegroups.com.
To post to this group, send email to pyspide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyspider-users/CAH-droy7-iXQR2YkGmGCsuyddCwp_8GYPGSSNAZX12Zam8WVZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Nick Gilmour

unread,
Dec 24, 2017, 3:33:35 PM12/24/17
to Roy Binux, pyspider-users
Hi Roy,

thanks for the quick response!

OK, so you mean my own functions not pyspider functions.

On Sun, Dec 24, 2017 at 8:35 PM, Roy Binux <r...@binux.me> wrote:

projectA:

def foo(a):
  return a*a

projectB:

from projects import projectA
projectA.foo(1)


On Sun, 24 Dec 2017, 19:19 Nick Gilmour, <nicke...@gmail.com> wrote:
Hi all,

I would like to have a base project which other projects can use. In the documentation is mentioned that it is possible to import another project as a module with:

from projects import other_project

but I can't figure out how to use. What's the idea behind this? What can be shared among projects?

Can anyone provide an example?


Regards,
Nick

--
You received this message because you are subscribed to the Google Groups "pyspider-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyspider-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyspider-users@googlegroups.com.

Roy Binux

unread,
Dec 24, 2017, 4:16:00 PM12/24/17
to Nick Gilmour, pyspider-users

Yes, your function or class. It's designed for sharing.


On Sun, 24 Dec 2017, 20:33 Nick Gilmour, <nicke...@gmail.com> wrote:
Hi Roy,

thanks for the quick response!

OK, so you mean my own functions not pyspider functions.
On Sun, Dec 24, 2017 at 8:35 PM, Roy Binux <r...@binux.me> wrote:

projectA:

def foo(a):
  return a*a

projectB:

from projects import projectA
projectA.foo(1)


On Sun, 24 Dec 2017, 19:19 Nick Gilmour, <nicke...@gmail.com> wrote:
Hi all,

I would like to have a base project which other projects can use. In the documentation is mentioned that it is possible to import another project as a module with:

from projects import other_project

but I can't figure out how to use. What's the idea behind this? What can be shared among projects?

Can anyone provide an example?


Regards,
Nick

--
You received this message because you are subscribed to the Google Groups "pyspider-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyspider-user...@googlegroups.com.
To post to this group, send email to pyspide...@googlegroups.com.

Nick Gilmour

unread,
Dec 24, 2017, 4:26:51 PM12/24/17
to Roy Binux, pyspider-users
OK, many thanks!

On Sun, Dec 24, 2017 at 10:15 PM, Roy Binux <r...@binux.me> wrote:

Yes, your function or class. It's designed for sharing.

On Sun, 24 Dec 2017, 20:33 Nick Gilmour, <nicke...@gmail.com> wrote:
Hi Roy,

thanks for the quick response!

OK, so you mean my own functions not pyspider functions.
On Sun, Dec 24, 2017 at 8:35 PM, Roy Binux <r...@binux.me> wrote:

projectA:

def foo(a):
  return a*a

projectB:

from projects import projectA
projectA.foo(1)


On Sun, 24 Dec 2017, 19:19 Nick Gilmour, <nicke...@gmail.com> wrote:
Hi all,

I would like to have a base project which other projects can use. In the documentation is mentioned that it is possible to import another project as a module with:

from projects import other_project

but I can't figure out how to use. What's the idea behind this? What can be shared among projects?

Can anyone provide an example?


Regards,
Nick

--
You received this message because you are subscribed to the Google Groups "pyspider-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyspider-users+unsubscribe@googlegroups.com.
To post to this group, send email to pyspider-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages