Jump to content


Photo

Calling other python file

python flask

  • Please log in to reply
1 reply to this topic

#1 amserver

amserver

    Newbie

  • Members
  • 5 posts

Posted 09 April 2021 - 03:59 AM

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

 

 



#2 verne100

verne100

    Newbie

  • Members
  • 1 posts

Posted 19 April 2021 - 02:52 PM

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







Also tagged with one or more of these keywords: python, flask

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users