Jump to content

Calling other python file


Recommended Posts

Hi there, I'm in Johnny server. I followed how to start flask app in the server. I'm just wondering how to import function from the cloudapi.py to the myapp.py, for example:

 

file: myapp.py

 

from cloudapi import *

 

 

Structure of the folder in

/home/mowaseem/public_html/flask/

                    |

                    |_____ .htaccess

                    |

                    |_____ cloudapi.py    

                    |

                    |_____ flask.wsgi

                    |

                    |_____ myapp.py

                    |

                    |_____ settings.conf

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi there, I'm in Johnny server. I followed how to start flask app in the server. I'm just wondering how to import function from the cloudapi.py to the myapp.py, for example:

 

file: myapp.py

 

from cloudapi import *

 

 

Structure of the folder in

/home/mowaseem/public_html/flask/

                    |

                    |_____ .htaccess

                    |

                    |_____ cloudapi.py    

                    |

                    |_____ flask.wsgi

                    |

                    |_____ myapp.py

                    |

                    |_____ settings.conf

 

 

I think you just write

 

import cloudapi

 

at the top of the myapp.py. Then you can call cloudapi.function() in myapp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...